Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there any command line utilities for Linux (or other Unix-like OS) which can:

  • Generate an .ico file with multiple icons in it
  • Do it from only 1 (one) png or jpeg image

For example:

% cool_icon_maker myimage_128x128.png file.ico

In file.ico there should automatically be all the icon sizes like 128x128, 64x64, 32x32, 16x16, etc.

share|improve this question
up vote 6 down vote accepted

I don't know all-in-one solution, but I know two pieces that can be brought together:

  • icoutils has icotool, which can create/extract .ico files.
  • ImageMagick has convert, which can convert and resize the files to the desired sizes.

So, something like this will work (it may only work for files with ".png" extension):

#!/bin/bash

# Just pass the original .png image as the only parameter to this script.
SOURCE="$1"
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's damn ugly, I know. But it is simple to understand, and it works (I tested it!). Just be careful, as it will create temporary files on current directory, and later delete them.

share|improve this answer

I don't think there is, but it probably would be a couple of lines script using "convert".

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .