Question

I'm trying to save a TGA image. I've got the data as a CGImageRef and used CFDataCreateMutable to get the CFMutableDataRef, but I'm not sure what type argument with which to call CGImageDestinationCreateWithData. Looking at the UTType reference, these are the types which it says are supported by core graphics:

const CFStringRef kUTTypeImage;
const CFStringRef kUTTypeJPEG;
const CFStringRef kUTTypeJPEG2000;
const CFStringRef kUTTypeTIFF;
const CFStringRef kUTTypePICT;
const CFStringRef kUTTypeGIF;
const CFStringRef kUTTypePNG;
const CFStringRef kUTTypeQuickTimeImage;
const CFStringRef kUTTypeAppleICNS
const CFStringRef kUTTypeBMP;
const CFStringRef kUTTypeICO;

Would I use kUTTypeImage? If so, how would I let it know that I want to encode it as TGA? Should I put it into an intermediate format and then do the conversion myself?

No correct solution

OTHER TIPS

It turns out that these UTIs can be created from a string. So, the code for the TGA UTI would be:

CFStringCreateWithCString(kCFAllocatorDefault, "com.truevision.tga-image", kCFStringEncodingASCII);

...in place of kUTTypeImage etc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top