Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
396 views
in Technique[技术] by (71.8m points)

icons - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...