I have several Mac apps already created using another tool that I need to create Apple images for. They were created as PNG files without an alpha channel and stored in a folder.
I attempted to do the following command:
iconutil -c icons myfolder.iconset
I got multiple errors like below:
iconutil error: Unsuported image format
After reading this blog post along with a couple of posts on Stack Overflow I saw that I needed to have an alpha channel on my images. This is not stated in the Apple Developer documentation.
I tried using Preview for this but from the research I have done, including watching several videos I would have to remove a color which would mess up my icons, especially the smaller ones. My icons have a black background and attempting to remove what little white is on them would be a nightmare for the smaller icons.
There is a comment on this link by David Grayson that stated that ImageMagick could be used to add the alpha channel. The comment said that if I executed the following command for each png file that should work.
convert old_icon_16x16.png -define png:color-type=6 icon_16x16.png
However when I execute this I get the following error:
Abort trap: 6
I then went to this link referenced by the main ImageMagick website for examples. I tried the following command.
convert old_icon_16x16.png -alpha off -alpha on icon_16x16.png
I got the following error:
Abort trap: 6
I'm not sure where to go from here.
If you are getting Abort
or Segmentation Faults
, it smacks of a mismatch in the compiling/building/linking of your ImageMagick.
I would suggest you remove whatever you have installed of ImageMagick, and start afresh with homebrew
which is the simplest way of installing ImageMagick on OSX. Basically, you go to the Homebrew website and copy and paste the one-liner into Terminal to install it (I don't want to show the line here in case it changes in future and this gets out of date).
Once you have homebrew installed, it is just a matter of:
brew install imagemagick
If, you want to see the options for supporting X11, TIFF, fftw etc, just run:
brew options imagemagick
Output
--with-fftw
Compile with FFTW support
--with-fontconfig
Build with fontconfig support
--with-ghostscript
Build with ghostscript support
--with-hdri
Compile with HDRI support
--with-jp2
Compile with Jpeg2000 support
--with-liblqr
Build with liblqr support
--with-librsvg
Build with librsvg support
--with-libwmf
Build with libwmf support
--with-little-cms
Build with little-cms support
--with-little-cms2
Build with little-cms2 support
--with-openexr
Build with openexr support
--with-openmp
Compile with OpenMP support
--with-pango
Build with pango support
--with-perl
enable build/install of PerlMagick
--with-quantum-depth-16
Compile with a quantum depth of 16 bit
--with-quantum-depth-32
Compile with a quantum depth of 32 bit
--with-quantum-depth-8
Compile with a quantum depth of 8 bit
--with-webp
Build with webp support
--with-x11
Build with x11 support
--without-freetype
Build without freetype support
--without-jpeg
Build without jpeg support
--without-libpng
Build without libpng support
--without-libtiff
Build without libtiff support
--without-magick-plus-plus
disable build/install of Magick++
--without-opencl
Disable OpenCL
--HEAD
Install HEAD version
Then you can either do:
brew install imagemagick --with-hdri --with-librsvg
or, if you have already installed ImageMagick, you can change your installed options with:
brew reinstall imagemagick --with-x11 ...
As Glenn points out in the comments, an easier command than the one you are using is probably:
convert old_icon_16x16.png png32:icon_16x16.png
Also, note that convert
becomes magick
from Version 7 onwards - though homebrew
is still delivering Version 6 at the moment.