Creating a .icns file again


John Brownie
 

I can't seem to find a way to handle the dark/light versions. Trying iconutil with a system .icns file just gives me the regular ones. So, to make life simpler, I'll just ignore the dark versions and go with the light. It gives my users something to play with while I find a better solution.

Thanks for the help.
John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Alex Zavatone
 

Why no alpha?  

Also, just enter man iconutil.

More details.


Lots here.


Old docs:

Use iconutil to Create an icns File Manually

The iconutil command-line tool converts iconset folders to deployment-ready, high-resolution icns files. (You can find complete documentation for this tool by entering man iconutil in Terminal.) Using this tool also compresses the resulting icns file, so there is no need for you to perform additional compression.
It looks like you already have this part

  • icon_16x16.png
  • icon_16x16@...
  • icon_32x32.png
  • icon_32x32@...
  • icon_128x128.png
  • icon_128x128@...
  • icon_256x256.png
  • icon_256x256@...
  • icon_512x512.png
  • icon_512x512@...

Though it’s an old tip…

Let Xcode Create an icns File Automatically

Xcode 4.4 automatically validates and converts an iconset folder to an icns file. All you need to do is add the iconset folder to your project and build the project. The generated icns file is added automatically to the built product.
Do that and see what it creates.  Convert the icns back to a .iconset with iconutil and see what the results are.  There might be special naming conventions for dark mode files.






On Nov 17, 2018, at 4:44 PM, John Brownie <john_brownie@...> wrote:

OK, now I need to know how to use iconutil, since it's probably changed with Mojave by adding dark mode variants. I get the following icons:
NSISIconImageRep 0x600001873180 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=128x128 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001870140 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=128x128 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001871780 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001872800 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001872fc0 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=16x16 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x6000018737c0 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=16x16 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001870480 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001873700 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186c400 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=18x18 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x60000186f580 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=18x18 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186f8c0 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x60000186ff80 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186d800 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x60000186bc40 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186bbc0 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=64x64 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001864f00 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=64x64 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018566c0 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001856b40 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018563c0 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=72x72 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001850380 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=72x72 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000184cc40 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=48x48 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x6000018408c0 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=48x48 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001840780 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=96x96 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001840c00 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=96x96 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000183cac0 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001839b80 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001839740 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001838a80 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001839b00 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001839d40 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018297c0 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001828b40 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018164c0 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001817040 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001815d40 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=2048x2048 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x6000018147c0 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=2048x2048 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua

I need to create files for 16x16 up to 1024x1024 in normal and @2x size, but how do I specify light/dark? Stack Exchange tells me that these files will work, but that's pre-Mojave:
icon_16x16.png
icon_16x16@...
icon_32x32.png
icon_32x32@...
icon_128x128.png
icon_128x128@...
icon_256x256.png
icon_256x256@...
icon_512x512.png
icon_512x512@...

man iconutil doesn't help, and I can't find anything with a search.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland





John Brownie
 

OK, now I need to know how to use iconutil, since it's probably changed with Mojave by adding dark mode variants. I get the following icons:
NSISIconImageRep 0x600001873180 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=128x128 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001870140 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=128x128 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001871780 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001872800 Size={128, 128} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001872fc0 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=16x16 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x6000018737c0 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=16x16 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001870480 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001873700 Size={16, 16} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186c400 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=18x18 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x60000186f580 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=18x18 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186f8c0 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x60000186ff80 Size={18, 18} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186d800 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x60000186bc40 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=32x32 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000186bbc0 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=64x64 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001864f00 Size={32, 32} ColorSpace=Generic RGB colorspace BPS=0 Pixels=64x64 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018566c0 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001856b40 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=36x36 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018563c0 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=72x72 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001850380 Size={36, 36} ColorSpace=Generic RGB colorspace BPS=0 Pixels=72x72 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000184cc40 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=48x48 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x6000018408c0 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=48x48 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001840780 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=96x96 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001840c00 Size={48, 48} ColorSpace=Generic RGB colorspace BPS=0 Pixels=96x96 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x60000183cac0 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001839b80 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=256x256 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001839740 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001838a80 Size={256, 256} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001839b00 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001839d40 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=512x512 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018297c0 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001828b40 Size={512, 512} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x6000018164c0 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x600001817040 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=1024x1024 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua,
NSISIconImageRep 0x600001815d40 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=2048x2048 Alpha=NO AppearanceName=NSAppearanceNameAqua,
NSISIconImageRep 0x6000018147c0 Size={1024, 1024} ColorSpace=Generic RGB colorspace BPS=0 Pixels=2048x2048 Alpha=NO AppearanceName=NSAppearanceNameDarkAqua

I need to create files for 16x16 up to 1024x1024 in normal and @2x size, but how do I specify light/dark? Stack Exchange tells me that these files will work, but that's pre-Mojave:
icon_16x16.png
icon_16x16@2x.png
icon_32x32.png
icon_32x32@2x.png
icon_128x128.png
icon_128x128@2x.png
icon_256x256.png
icon_256x256@2x.png
icon_512x512.png
icon_512x512@2x.png

man iconutil doesn't help, and I can't find anything with a search.

John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


John Brownie
 

OK, that looks hopeful. I'll have to dig a bit further to find out all I need, but this seems to get me in a better direction.

John

Alex Zavatone via Groups.Io wrote on 17/11/18 12:11:

Apple recommends using the command-line utility iconutil, which ships with macOS




 iconutil -- Utility to convert between '.iconset' and '.icns' files.


Gotta leave it at that for the moment.  I’ve got stuff to do.  Hope this helps.

On Nov 17, 2018, at 3:01 PM, Alex Zavatone via Groups.Io <zav@...> wrote:

Do you just need to do this once, or is this a reoccurring thing you need to do while your app is running?

Hmm.  I just did this converting PNG images.  I’ll take a look.

There also are online resources that may work to provide you with working samples like this one.  https://iconverticons.com/online/

Did this work in High Sierra?





On Nov 17, 2018, at 2:55 PM, John Brownie <john_brownie@...> wrote:

I solved this problem in 2012, and then again in 2014, when a change disrupted things. Now Mojave is changing the playing field once more...

The problem:
I need to get the icon for the current keyboard layout and save it in a .icns file, since that's what you have to have.

The old solution:
I get the icon via:
IconRef keyboardIcon = TISGetInputSourceProperty(currentInputSource, kTISPropertyIconRef);

I then get the image representations via:
NSImage *iconImage = [[NSImage alloc] initWithIconRef:keyboardIcon];
NSArray *iconImageReps = [iconImage representations];

The next step is to build a CGImageDestination. The old problem was that CGImageDestinationCreateWithData had a hard limit (undocumented, of course) of 15 images. That limit has apparently now been reduced to 10, only documented by an error message.

Workarounds and the new problem:
My old workaround was to limit it to images smaller than 128x128, which worked. Unfortunately, I now get 36 image representations, and picking 10 doesn't give me enough representations, and I get this message from CGImageDestinationFinalize:
finalize:2477: image destination does not have enough images

The Image I/O documentation says it's no longer being updated, and the last revision date is 2016-09-03. Nothing says that it's deprecated or replaced by something else, as far as I can see.

Am I missing something? Or is there a solution that will actually work?

Thanks for any pointers.
John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland









--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland


Alex Zavatone
 

Apple recommends using the command-line utility iconutil, which ships with macOS




 iconutil -- Utility to convert between '.iconset' and '.icns' files.


Gotta leave it at that for the moment.  I’ve got stuff to do.  Hope this helps.

On Nov 17, 2018, at 3:01 PM, Alex Zavatone via Groups.Io <zav@...> wrote:

Do you just need to do this once, or is this a reoccurring thing you need to do while your app is running?

Hmm.  I just did this converting PNG images.  I’ll take a look.

There also are online resources that may work to provide you with working samples like this one.  https://iconverticons.com/online/

Did this work in High Sierra?





On Nov 17, 2018, at 2:55 PM, John Brownie <john_brownie@...> wrote:

I solved this problem in 2012, and then again in 2014, when a change disrupted things. Now Mojave is changing the playing field once more...

The problem:
I need to get the icon for the current keyboard layout and save it in a .icns file, since that's what you have to have.

The old solution:
I get the icon via:
IconRef keyboardIcon = TISGetInputSourceProperty(currentInputSource, kTISPropertyIconRef);

I then get the image representations via:
NSImage *iconImage = [[NSImage alloc] initWithIconRef:keyboardIcon];
NSArray *iconImageReps = [iconImage representations];

The next step is to build a CGImageDestination. The old problem was that CGImageDestinationCreateWithData had a hard limit (undocumented, of course) of 15 images. That limit has apparently now been reduced to 10, only documented by an error message.

Workarounds and the new problem:
My old workaround was to limit it to images smaller than 128x128, which worked. Unfortunately, I now get 36 image representations, and picking 10 doesn't give me enough representations, and I get this message from CGImageDestinationFinalize:
finalize:2477: image destination does not have enough images

The Image I/O documentation says it's no longer being updated, and the last revision date is 2016-09-03. Nothing says that it's deprecated or replaced by something else, as far as I can see.

Am I missing something? Or is there a solution that will actually work?

Thanks for any pointers.
John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland









Alex Zavatone
 

Do you just need to do this once, or is this a reoccurring thing you need to do while your app is running?

Hmm. I just did this converting PNG images. I’ll take a look.

There also are online resources that may work to provide you with working samples like this one. https://iconverticons.com/online/

Did this work in High Sierra?

On Nov 17, 2018, at 2:55 PM, John Brownie <john_brownie@sil.org> wrote:

I solved this problem in 2012, and then again in 2014, when a change disrupted things. Now Mojave is changing the playing field once more...

The problem:
I need to get the icon for the current keyboard layout and save it in a .icns file, since that's what you have to have.

The old solution:
I get the icon via:
IconRef keyboardIcon = TISGetInputSourceProperty(currentInputSource, kTISPropertyIconRef);

I then get the image representations via:
NSImage *iconImage = [[NSImage alloc] initWithIconRef:keyboardIcon];
NSArray *iconImageReps = [iconImage representations];

The next step is to build a CGImageDestination. The old problem was that CGImageDestinationCreateWithData had a hard limit (undocumented, of course) of 15 images. That limit has apparently now been reduced to 10, only documented by an error message.

Workarounds and the new problem:
My old workaround was to limit it to images smaller than 128x128, which worked. Unfortunately, I now get 36 image representations, and picking 10 doesn't give me enough representations, and I get this message from CGImageDestinationFinalize:
finalize:2477: image destination does not have enough images

The Image I/O documentation says it's no longer being updated, and the last revision date is 2016-09-03. Nothing says that it's deprecated or replaced by something else, as far as I can see.

Am I missing something? Or is there a solution that will actually work?

Thanks for any pointers.
John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland



John Brownie
 

I solved this problem in 2012, and then again in 2014, when a change disrupted things. Now Mojave is changing the playing field once more...

The problem:
I need to get the icon for the current keyboard layout and save it in a .icns file, since that's what you have to have.

The old solution:
I get the icon via:
IconRef keyboardIcon = TISGetInputSourceProperty(currentInputSource, kTISPropertyIconRef);

I then get the image representations via:
NSImage *iconImage = [[NSImage alloc] initWithIconRef:keyboardIcon];
NSArray *iconImageReps = [iconImage representations];

The next step is to build a CGImageDestination. The old problem was that CGImageDestinationCreateWithData had a hard limit (undocumented, of course) of 15 images. That limit has apparently now been reduced to 10, only documented by an error message.

Workarounds and the new problem:
My old workaround was to limit it to images smaller than 128x128, which worked. Unfortunately, I now get 36 image representations, and picking 10 doesn't give me enough representations, and I get this message from CGImageDestinationFinalize:
finalize:2477: image destination does not have enough images

The Image I/O documentation says it's no longer being updated, and the last revision date is 2016-09-03. Nothing says that it's deprecated or replaced by something else, as far as I can see.

Am I missing something? Or is there a solution that will actually work?

Thanks for any pointers.
John
--
John Brownie
Mussau-Emira language, New Ireland Province, Papua New Guinea
Kouvola, Finland