Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recipe for creating Windows ICO files with ImageMagick?

I would like to create .ico icon for my Windows application dynamically (from the SVG file) by using ImageMagick. How do I do that?

Microsoft lists various color depth and size requirements for the icon. ImageMagick has the -depth and -colors options, but I'm not sure how to use them correctly in this case.

Additionaly, it looks like Vista+ supports 256x256 hi-res icon embedded into the very same .ico which can (should? must?) be a compressed PNG. How do I "join" the Windows XP icons and this new Vista icon into a single .ico file?

like image 950
Linas Valiukas Avatar asked Jul 10 '12 23:07

Linas Valiukas


1 Answers

ImageMagick has a recipe for this in their documentation, see FavIcon Web Page Link Thumbnail

Essentially you run the following:

convert image.png  -bordercolor white -border 0 \           \( -clone 0 -resize 16x16 \) \           \( -clone 0 -resize 32x32 \) \           \( -clone 0 -resize 48x48 \) \           \( -clone 0 -resize 64x64 \) \           -delete 0 -alpha off -colors 256 favicon.ico 

You can modify this to include larger resolutions as necessary and to change things like border, transparency settings etc.

like image 63
RobV Avatar answered Sep 17 '22 21:09

RobV