Re: Manipulating images with meta-data
Re: Manipulating images with meta-data
- Subject: Re: Manipulating images with meta-data
- From: "Ken Ferry" <email@hidden>
- Date: Thu, 5 Jun 2008 11:33:07 -0700
On Wed, Jun 4, 2008 at 4:38 PM, Randall Meadows <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden