• 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: Randall Meadows <email@hidden>
  • Date: Wed, 4 Jun 2008 17:38:03 -0600

On Jun 3, 2008, at 3:11 PM, Heinrich Giesen wrote:

I'm about to resort to using a third-part solution

This is a good idea! My favourite program is exiftool by Phil Harvey: http://www.sno.phy.queensu.ca/~phil/exiftool/

exiftool -Orientation=8 -n a.jpg

will do the job.

Yep, it does, and looks to be the perfect companion to jpegtran. Thanks for the pointer, I hadn't found this one in my searching.


On Jun 3, 2008, at 9:53 PM, Ken Ferry wrote:

Can we see the code you're using to write the CGImage to the CGImageDestination?

I suspect the difficulty may be that you expect the metadata to be carried with the CGImage.

I was thinking the CGImageSourceRef...

It isn't: You can get all the metadata with CGImageSourceCopyPropertiesAtIndex, then you need to turn around

And I was getting them via CGImageSourceCopyProperties(), which, as you correctly state and I eventually found out, is wrong.


Last, I think rotation can be performed losslessly on a JPEG, but not with anything that ships on current versions of Mac OS X. If that's important, you still might want an external library.

Yeah, I'm using jpegtran to do this, and for some reason (they make a lame [IMO] attempt at explaining why) they don't "fix" the orientation tag when it rotates an image. So enter 'exiftool" as Heinrich suggested above.



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);


Does this further degrade my image?
_______________________________________________

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


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

  • Prev by Date: Re: NSAppleScript question
  • Next by Date: no copy/paste - responder chain problem?
  • Previous by thread: Re: Manipulating images with meta-data
  • Next by thread: Re: Manipulating images with meta-data
  • Index(es):
    • Date
    • Thread