I've been using ImageMagick, but it produces a very blurry result.
convert -density 300 ../images/favicons/procensus.svg -background transparent -colors 256 -define icon:auto-resize favicon2.ico
It seems to be rendering the image at 300 density, then resizing that with a Gaussian filter for all the other sizes in the icon.
What I actually want it to do is re-render with shape-rendering="crispEdges" at each pixel size in the favicon.
I want ImageMagick (or whatever other tool) to re-render the SVG at each provided density of .ico.
Note that this tool should only be a tool I can use at package build time: an open-source piece of installable software for Linux.
Using a test SVG, I managed to get a multi-size ico file with this command - you can change the sizes as necessary.
convert procensus.svg -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-alpha off -colors 256 favicon.ico
Try this one liner. Self-explanatory I think.
convert -density 300 -define icon:auto-resize=256,128,96,64,48,32,16 -background none input.svg out.ico
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With