1

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.

Community
  • 1
  • 1
  • How did you install ImageMagick? I suspect you would be well advised to remove it and use `homebrew` to install it. That involves going to http://brew.sh and copying and pasting a one-liner into Terminal, followed by `brew install imagemagick`. – Mark Setchell May 23 '16 at 20:49
  • I unpacked the tar file and tried to go through the steps. Even though the commands they stated to execute in terminal 'worked' I cannot do anything else. I have homebrew installed but don't use it much. I will remove my mess and install using homebrew. Thanks! – Pamela Cook - LightBe Corp May 23 '16 at 20:54
  • @MarkSetchell it worked. I was able to execute the first command I mentioned and verified that my image had alpha channel set to yes. Please post it as an answer and I will upcheck it. I noticed that Homebrew installed 6.9.3-7. The one I installed was 7.0.1. I thought it was a stable version but it was a mess. Thanks again! – Pamela Cook - LightBe Corp May 23 '16 at 21:03
  • Your commands look OK, but a shorter and perhaps easier-to-remember command is "convert old_icon_16x16.png png32:icon_16x16.png". Also, in the most recent versions, the "convert" command has become the "magick" command, although "convert" will continue to be recognized for now. @MarkSetchell, feel free to incorporate these remarks in your answer if you want. – Glenn Randers-Pehrson May 23 '16 at 21:19
  • Glad it worked out for you - I have added an answer with a bit more info too. Good luck with your project! – Mark Setchell May 23 '16 at 21:21
  • @GlennRanders-Pehrson Thank you again, Glenn. I have added your insights into my answer. – Mark Setchell May 23 '16 at 21:26

1 Answers1

1

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.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • I was successful in using the Homebrew version of InageMagick. I was running 7.0.1. I wonder if my commands would have worked if I had used magick instead of convert. Not important with my version. Thanks so much! I'm able to continue with my apple icons. – Pamela Cook - LightBe Corp May 24 '16 at 00:46
  • @LightBeCorp "convert" will continue to work for a while, to allow for transition. You might see a warning but otherwise "convert" and "magick" will produce the same result. – Glenn Randers-Pehrson May 24 '16 at 16:00