5

(The next level from Creating an .ico file with multiple sizes - web application)

How can I combine multiple pngs of different sizes into a single ico? I want the 256x256 and 128x128 versions to look the same, but 32x32 and 64x64 to be from a different file. How can I do this on a mac?

2
  • 2
    While the first question mentions only one file and different sizes, this one is about different files (I know because I asked it myself :P). Or do you mean to do something else?
    – Yisela
    Mar 13, 2014 at 3:53
  • @Yisela Ooh. Sems legit (testing now).
    – bjb568
    Mar 13, 2014 at 3:54

3 Answers 3

5

This is actually very easy to do with ImageMagick.

I recently wrote a little utility faviconbuild which I have released on github under the MIT Open Source license.

This is a link to the shell script I wrote for Unix / Mac (and Windows if you use Cygwin). I also provide a bat file for anyone on Windows. I would like to encourage anyone to contribute to the project as well, including feature requests. You can read more about it on the project page and I have also included a link to download the ImageMagick binaries I was using during development.

There is a subroutine named createIcon where I do the work, but here is a short example of using ImageMagick directly to package different source files into a .ico file.

convert "image1.png" "image2.png" "image3.png" "result.ico"

The website also has some other usage examples such as the one found here.

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

This does the work of resizing an image and creating an icon with one line of script (or multiline with the \ character at the end of the line). Obviously this one liner doesn't give you the option to pick and choose the source image per size though.

I have also published a blog post on the development that serves as a mini tutorial for batch/bash for those interested.

4

When I tried doing this, I got some cryptic error message when trying to save as PNG… anyway, I eventually did this:

http://regx.dgswa.com/html/Gimp+ico+how+to

  1. Open your image in Gimp
  2. Make your canvas square
  3. Resize your layer to the image
  4. Scale the layer to the largest size in your .ico file like 64 pixels
  5. Duplicate the layer
  6. Scale the duplicate layer to the next size
  7. Keep duplicating / scaling for all the sizes you want in your .ico file
  8. Save as .ico
1

I've written a small webapp called IcollatorForever that will let you do this. It's here:

https://adv12.github.io/IcollatorForever/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.