I've been trying to use iconutil to generate .icns icons from the .png images inside the folder "folderthumb.iconset", with the following command:
iconutil -c icns folderthumb.iconset
Everything goes well when the source png have alpha transparency. However, when the PNGs are opaque (from sips, hasAlpha=no) iconutil returns the error:
Unsuported image format
My libpng is v1.6, installed with brew
.
Has anyone tips on how to sort this problem out?
Older versions of iconutil did not require the png files to have an alpha channel, the version of iconutil distributed with OS X 10.11 (or did it come with a recent Xcode? I'm not sure...) does.
If you have icons with transparent parts, this should be no problem because I'd expect all graphics tools to include the alpha channel when exporting to png. However if you have a fully opaque icon, most tools and applications remove the alpha channel when exporting to png.
Here is how I resolved this: I installed ImageMagick (e.g. via Mac OS Ports), then used ImageMagick's command line tool convert
to add the alpha channel and set the color space to sRGB (which is recommended by iconutil):
convert input.png -alpha Set -colorspace sRGB -define png:format=png32 output.png
If you do this for all icons in your iconset folder, iconutil should then no longer return an error.