I'm trying to create a paletted (indexed) PNG using CoreGraphics.
The best I've found is that I can use:
CGColorSpaceRef colorSpace = CGColorSpaceCreateIndexed(CGImageGetColorSpace(maskedImage), 255, <#const unsigned char *colorTable#>);
Then:
CGImageRef palettedImage = CGImageCreateCopyWithColorSpace(maskedImage, colorSpace)
However I'm not sure what to put as the colorTable. I'd like to leverage some pre-made (fast) quantization algorithm - such as the one that is already built in to ImageIO when calling CGImageDestinationCreateWithURL(url, kUTTypeGIF , 1, NULL);
How do I create a palette for the PNG?