On Wed, Jun 4, 2008 at 4:38 PM, Randall Meadows <[EMAIL PROTECTED]> wrote: > On a related note, can anyone tell me if creating a CGImageSourceRef from a > file, changing (only) its properties, and writing it back out--does that > cause another (lossy) JPEG compression? As in: > > cgImage = CGImageSourceCreateWithURL((CFURLRef)url, NULL); > imageRef = CGImageSourceCreateImageAtIndex(cgImage, 0, NULL); > tmpProps = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(cgImage, 0, > NULL); > props = [[tmpProps mutableCopy] autorelease]; > [props setValue:[NSNumber numberWithInt:1] forKey:@"Orientation"]; > fileURL = [NSURL fileURLWithPath:filePath]; > imageDest = CGImageDestinationCreateWithURL((CFURLRef)fileURL, kUTTypeJPEG, > 1, NULL); > CGImageDestinationAddImage(imageDest, imageRef, (CFDictionaryRef)props); > CGImageDestinationFinalize(imageDest); >
Well, for that case you could have just checked, since you wrote the code already. :-) Yes, unfortunately a JPEG is always decoded and recompressed. Also, above you probably want to copy over the source level properties, not just the properties at the contained image level. -Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]