I'm re-sizing some NSBitmapImage reps (mostly JPGs or RAW, both full- size images straight from a digital camera)...

I'm working almost exclusively with NSBitmapImageRep (using [NSGraphicsContext graphicsContextWithBitmapImageRep:] when drawing etc..)

With some images( the ones I took with my Canon camera) the orientation is automatically handled (i.e. Portrait images are rotated automatically) without me doing anything! I'm just re-sizing them and they get rotated automatically!

With other images (JPGs and NEF images that I took with my Nikon cam), it doesn't happen...

Now I was wondering, how am I supposed to deal with this inconsistent behavior? Especially if I want to rotate my pictures automatically when I re-draw them...

I'm able to get the Image orientation using a CGImageSourceRef and the kCGImagePropertyOrientation property.. and that property seems to give a correct value with all the images I tried... my first instinct was to use this property and rotate the picture if needed (i.e. if the orientation is != 1... rotate accordingly)... but it definitely wouldn't work with my Canon pictures, which somehow get rotated automatically without me having to do anything... (i.e. if I read the kCGImagePropertyOrientation and see that it's not equal to 1, I rotate the picture... which has already been rotated automatically... so I end up with an image that has been rotated twice...)....

Is there any reliable way I can rotate my images to the correct orientation ??

Jean-Nicolas Jolivet
[email protected]
http://www.silverscripting.com

_______________________________________________

Cocoa-dev mailing list ([email protected])

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]

Reply via email to