Icons command line generator

Are there any kind of command line energies for Linux (or various other Unix - like OS) which can:

  • Generate an.ico documents with numerous icons in it
  • Do it from just 1 ( one ) png or jpeg photo

For instance:

% cool_icon_maker myimage_128x128.png file.ico

In file.ico there need to instantly be all the symbol dimensions like 128x128, 64x64, 32x32, 16x16, etc.

2022-06-07 14:42:50
Source Share
Answers: 2

I do not assume there is, yet it possibly would be a number of lines script making use of "convert".

2022-06-07 15:15:35

I do not recognize all - in - one remedy, yet I recognize 2 items that can be united:

  • icoutils has icotool, which can create/extract. ico documents
  • ImageMagick has convert, which can transform and also resize the documents to the wanted dimensions

So, something similar to this will certainly function (it might just benefit documents with ".png" expansion):


# Just pass the original .png image as the only parameter to this script.
BASE=`basename "${SOURCE}" .png`

convert "${SOURCE}" -thumbnail 16x16 "${BASE}_16.png"
convert "${SOURCE}" -thumbnail 32x32 "${BASE}_32.png"
convert "${SOURCE}" -thumbnail 48x48 "${BASE}_48.png"
convert "${SOURCE}" -thumbnail 64x64 "${BASE}_64.png"

icotool -c -o "${BASE}.ico" "${BASE}"_{16,32,48,64}.png

rm -f  "${BASE}"_{16,32,48,64}.png

It is damn hideous, I recognize. Yet it is straightforward to recognize, and also it functions (I examined it!). Simply take care, as it will certainly create short-lived documents on existing directory site, and also later on delete them.

2022-06-07 15:15:29