views:

131

answers:

1

I'm writing a Carbon application and we are creating JPEG files. I'm currently doing this by using Quartz CGImageDestinations and kCGImagePropertyJFIFDictionary. However, JFIF doesn't seem to have any entry for compression quality. Does anyone know how to set this?

thanks

+2  A: 

This is separate from the JFIF options, since some other formats (including TIFF) support lossy compression. The key you use is kCGImageDestinationLossyCompressionQuality, and you put this option and the JFIF-options dictionary into the same dictionary; you don't put it into the JFIF-options dictionary.

Peter Hosey
Actually, the mac doesn't seem to support lossy TIFF... only LZW. but this works for JPEG! thanks
Brian Postow
Huh, you're (sort of) right. The relevant key is kCGImagePropertyTIFFCompression, and I found a blog post that suggests you use NSTIFFCompression constants with it, but the documentation of NSTIFFCompressionJPEG says that it's no longer supported. (OTOH, PackBits and CCITT fax are.) Weird.
Peter Hosey