Sunday, April 17, 2011

JPEG Quality when creating a JPEG in Carbon

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

From stackoverflow
  • 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.

    Brian Postow : Actually, the mac doesn't seem to support lossy TIFF... only LZW. but this works for JPEG! thanks
    Peter Hosey : 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.

0 comments:

Post a Comment