[ACCEPTED]-Convert favicon.ico to png to using ImageMagick Procedurally-image-conversion

Accepted answer
Score: 23

I came across with the same problem while 3 I was trying to convert blogger's favicon 2 and I solved it by using -flatten parameter of Imagemagick 1 like this:

convert "favicon.ico" -thumbnail 16x16 -alpha on -background none -flatten "favicon.png"

alt text

Score: 3

This likely happens because there are multiple 6 images in the icon file - this is to provide 5 differet resolutions for different contexts. Presumably 4 you'd want to run a search in the target 3 directory for favicon*.png, then check the dimensions 2 of each one to find the one you wanted (deleting 1 the others as you go).

Score: 2

I guess some of these are animated gifs. You 9 can take the first one as described here:


$magick> convert 'images.gif[0]' image.png

I 8 don't have ImageMagic installed, but you 7 might try the above for all favicon.ico, it 6 might work fine.

Otherwise, you would probably 5 need to write a script to check for favicon-01.png 4 and, if it exists, rename it to favicon.png 3 and delete favicon-*.png (provided you don't 2 have anything else named like that in the 1 working folder).

More Related questions