• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Manipulating images with meta-data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Manipulating images with meta-data (From: Randall Meadows <email@hidden>)
 >Re: Manipulating images with meta-data (From: "Ken Ferry" <email@hidden>)
 >Re: Manipulating images with meta-data (From: Randall Meadows <email@hidden>)

  • Prev by Date: Re: C99 [was: RESTful API's - Easy way to interact?]
  • Next by Date: Re: totally confused by bindings
  • Previous by thread: Re: Manipulating images with meta-data
  • Next by thread: Re: Manipulating images with meta-data
  • Index(es):
    • Date
    • Thread