Recipe for creating Windows ICO files with ImageMagick?

后端 未结 9 1257
长发绾君心
长发绾君心 2020-12-13 07:18

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 vari

9条回答
  •  一向
    一向 (楼主)
    2020-12-13 08:10

    Bash one-liner to convert logo.svg into logo.ico, using Inkscape to export the png images at various sizes:

    eval convert \
      '<(inkscape -e /dev/stderr logo.svg -w '{16,24,32,48,64,128,256}' 2>&1 > /dev/null)' \
      logo.ico
    

    Inspired by Malcolm MacLeod's answer, but avoiding the explicit loop and the temporary files.

    The stderr and redirection is to avoid Inkscape's success message on stdout (“Bitmap saved as: /dev/stdout”) ending up in the image data.

提交回复
热议问题