I am exporting an animated gif using swift targeting Mac OS, which works but the properties I've set aren't being applied. I have set up my properties and when I log them they show up like so:
{
HasGlobalColorMap = 1;
LoopCount = 0;
}
In a loop I add each frame to the destination:
CGImageDestinationAddImage(destination, cgGif, gifProperties as CFDictionaryRef)
Then after the loop I attempt to set the properties one more time and finalise the destination:
CGImageDestinationSetProperties(destination, gifProperties as CFDictionaryRef)
if (!CGImageDestinationFinalize(destination)) {
NSLog("failed to finalize image destination")
}
However the resulting image is not set to loop. Why would that be?
Actually, I've made some progress...
I was setting the options like this:
Which was giving me this structure:
I found an implementation that defined the properties like this:
giving this structure:
I then applied the fileProperties to the destination:
and the frameProperties to each images as it was added:
and, finally, it's working, they're being applied.
Haven't tried multiple properties yet but should be ok.