Skip to content

Icon size#407

Closed
andershol wants to merge 2 commits into
FreeCAD:mainfrom
andershol:icon-size
Closed

Icon size#407
andershol wants to merge 2 commits into
FreeCAD:mainfrom
andershol:icon-size

Conversation

@andershol

Copy link
Copy Markdown

Currently some addons have an icon with a large file size. This means that the addon_catalog_cache.zip used by the addon manager and by the website is currently ~2MB. This PR adds aliases for some of the largest icons that are 1/7th-1/686th of the original size and shrinks the zip file to ~400kB. Warning is also added for icons larger than 10kB (all of the aliases are < 5kB).

Most icons should be close to identical to the original, but I did add on lighting to EasyProfileFrame, MakerWorkbench and Cubinets.

The icons could of course be pushed upstream. I only tried with one PR that got no response. But the individual addons do not see much benefit in fiddling with size of their icon.

It feels like this script is in the wrong repository. Perhaps it should be move to e.g. Addons.

It is a bit silly that the text of the SVG files are utf-8 encoded, base64 encoded and then added to the json, instead of just being added to the json, as the base64 encoding reduces the effectiveness of the compression. An "icon_data_raw" property could be added to the json instead of the "icon_data" for svg files. But that would not be backwards compatible (icons would disappear from old versions of the addon manager).

@andershol

andershol commented Jun 10, 2026

Copy link
Copy Markdown
Author
freecad.gears workbench
36652 -> 4836 ~13.2%
WebTools
60355 -> 4187 ~6.9%
Optics Design Workbench
39918 -> 3930 ~9.8%
DesignSPHysics
1436708 -> 3535 ~0.2%
DFM
26266 -> 3263 ~12.4%
Assembly3
30188 -> 3246 ~10.8%
Machines
23462 -> 3191 ~13.6%
AIGenFurniture Cabinet Generator
28470 -> 3154 ~11.1%
Bill of Materials Workbench
28649 -> 2991 ~10.4%
FreeGrid Workbench
20682 -> 2500 ~12.1%
Built-In Preference Packs beta
16980 -> 2120 ~12.5%
ElectroMagnetic Workbench
20586 -> 2077 ~10.1%
Titleblock Workbench
25051 -> 1843 ~7.4%
boltsfc
20263 -> 1541 ~7.6%
Detessellate
27678 -> 1503 ~5.4%
EasyProfileFrame
31417 -> 1332 ~4.2%
Maker Workbench
19817 -> 1332 ~6.7%
Cubinets
17536 -> 1137 ~6.5%
Reinforcement
27955 -> 1000 ~3.6%
PieMenu
26892 -> 967 ~3.6%
NikraDAP
32433 -> 963 ~3%
Virtual Reality
7579 -> 936 ~12.3%
Woodworking
30929 -> 915 ~3%
MOOC
36063 -> 811 ~2.2%
Road
360865 -> 526 ~0.1%
Frame and beams workbench
12761 -> 282 ~2.2%
Ondsel Lens Addon
30331 -> 166 ~0.5%

@andershol

Copy link
Copy Markdown
Author

As luck would have it, after no activity for 3 months, the DesignSPHysics icon was merged into upstream an hour and a half after this issue was opened. 🤷

@chennes

chennes commented Jun 11, 2026

Copy link
Copy Markdown
Member

I'm sure you can get the Ondsel Lens merged :). Probably also Road, Machines, and AIGenFurniture. My preference would be to at least submit PRs for all of these and give their authors a chance to incorporate. And maybe @mnesarco could add this as an evaluation metric for the scanner.

@andershol andershol closed this Jun 11, 2026
@mnesarco

Copy link
Copy Markdown
Contributor

This PR adds automatic svg icons optimization to cache: #408

Raw: 4.1MB to 1.9MB
Compressed: 1.5 MB to 775 kB

@andershol

Copy link
Copy Markdown
Author

Yep, pretty bad. It is not clear what you are measuring, but by presumably optimizing all icons, you got a result twice as large as this PR got by optimizing only a couple of handfuls. I considered doing it automatically, and svgo looked most promising, but rejected it. Since it is relatively seldom a new addon is added, it probably make more sense just to reject icons over 10kB and warn if they are over 5kB.

@mnesarco

Copy link
Copy Markdown
Contributor

Addons-Report now checks for icons over 16kB (can be changed if it is too conservative) and report them.

FreeCAD/Addon-Reports@252a28e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants