ICO Packer

I always liked very much the Xcode tool Icon Composer, but it has gone, and the old versions won’t run on the latest macOS. For Mac programming, Xcode got its own icon handling facilities, and I am not missing the old Icon Composer for this use case. I am missing it when it comes to create Windows and Web compatible files in the ICO file format - s. this article for an example. I searched the web, and I found nothing really suitable - there were some online converters though.

So, I sat down and programmed the icopacker command line tool. I chose to publish it on GitHub under the 2-clause BSD license, see

  1. Create the design using your favorite graphics tool, I am comfortable with Adobe Illustrator:
  2. Export the design as PNG files in various pixel sizes, namely 16×16, 24×24, 32×32, 48×48, 128×128, 256×256, all into the same directory, let’s say ~/Desktop/ICOfiles/
  3. Download the icopacker.c source code file from the above mentioned GitHub site, and compile it using the following command:
       clang -g0 -O3 -std=c11 -fno-pic -fstrict-aliasing -fno-common \
       -fvisibility=hidden -Wno-parentheses icopacker.c -o icopacker
  4. Pack the PNG files in ~/Desktop/ICOfiles/ into one ICO file ~/Desktop/ICOfile.ico using the following command:
       ./icopacker ~/Desktop/ICOfiles/ ~/Desktop/ICOfile.ico
    mini:~/Desktop rolf$ ./icopacker ~/Desktop/ICOfiles/ ~/Desktop/ICOfile.ico
    added obsigna016.png, 16x16, 32bit
    added obsigna024.png, 24x24, 32bit
    added obsigna032.png, 32x32, 32bit
    added obsigna048.png, 48x48, 32bit
    added obsigna128.png, 128x128, 32bit
    added obsigna256.png, 256x256, 32bit
    6 PNG files from /Users/rolf/Desktop/ICOfiles/ have been packed into
    the ICO file /Users/rolf/Desktop/ICOfile.ico,
    having a total size of 58759 bytes.​


Keywords: ICO-file-format, icopacker

Copyright © Dr. Rolf Jansen - 2018-02-28 13:42:16

Discussion on Twitter: 1082813866747285507