How to generate favicon.ico¶
- Convert SVG to png:
inkscape --export-type=png statistical-python-logo.svg
- Convert png to multi-resolution icon:
convert statistical-python-logo.png -define icon:auto-resize=64,48,32,16 -colors 4 favicon.ico
To simplify SVGs for making icons¶
See the SimpleIcons guidelines:
- Isolate the icon from any text or extraneous items.
- Merge any overlapping paths.
- Compound all paths into one.
- Change the icon’s viewbox/canvas/page size to 24x24.
- Scale the icon to fit the viewbox, while preserving the icon’s original proportions. This means the icon should be touching at least two sides of the viewbox.
- Center the icon horizontally and vertically.
- Remove all colors. The icon should be monochromatic.
- Export the icon as an SVG.
They use SVGO to optimize SVGs. You can also use scour: pip install scour
.
scour --set-precision=2 --strip-xml-prolog --remove-metadata --enable-comment-stripping --enable-viewboxing --indent=none --no-line-breaks --strip-xml-space --shorten-ids --enable-id-stripping statistical-python-logo.svg statistical-python-icon.svg