아래 코드는 작동합니다. 하지만 여전히 내 쿼리에 대한 실제 답변을 찾을 수 없습니다. 대신
sips -s formatOptions packbits /DefaultGroup.tif
의
int compression = NSTIFFCompressionPackBits;
CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)dataToWrite, NULL);
CGImageRef imageRef = CGImageSourceCreateImageAtIndex(source, 0, NULL);
CFMutableDictionaryRef saveMetaAndOpts = CFDictionaryCreateMutable(nil,0,&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFMutableDictionaryRef tiffProfsMut = CFDictionaryCreateMutable(nil, 0,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(tiffProfsMut, kCGImagePropertyTIFFCompression, CFNumberCreate(NULL, kCFNumberIntType, &compression));
CFDictionarySetValue(saveMetaAndOpts, kCGImagePropertyTIFFDictionary, tiffProfsMut);
NSURL *outURL = [[NSURL alloc] initFileURLWithPath:filename];
CGImageDestinationRef dr = CGImageDestinationCreateWithURL ((CFURLRef)outURL, (CFStringRef)@"public.tiff" , 1, NULL);
CGImageDestinationAddImage(dr, imageRef, saveMetaAndOpts);
CGImageDestinationFinalize(dr);
CFRelease(dr);
[outURL release];
CFRelease(tiffProfsMut);
CFRelease(saveMetaAndOpts);
CFRelease(imageRef);
CFRelease(source);