• 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: NSBitmapImageRep orientation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBitmapImageRep orientation?


  • Subject: Re: NSBitmapImageRep orientation?
  • From: Jean-Nicolas Jolivet <email@hidden>
  • Date: Fri, 12 Dec 2008 19:58:19 -0500

Thanks a lot for the clarification!!

Oh BTW, just for giggles: If the image was rotated before, I'm pretty sure it was with Windows Picture & Fax Viewer! :)

Jean-Nicolas Jolivet

On 12-Dec-08, at 6:43 PM, Ken Ferry wrote:

On Fri, Dec 12, 2008 at 2:32 PM, Jean-Nicolas Jolivet
<email@hidden> wrote:
Hi there!

After some more tests (i.e. with sample canon images that I downloaded) it
doesn't seem to be a problem... so basically the problem only occurs with
one set of pictures that I have on my HD...


I don't remember rotating these pictures manually, but I guess it would
explain the weird behavior I'm getting when working with these images...


Anyway, here's one of those "odd" pictures, they dont get rotated if you
look at them in Preview, and still, if I process them (re-size them, using
NSBitmapImageRep etc...) they get rotated automatically...

Thanks.

Okay, what you have here is a corrupt image.  The data on the disk is
in orientation 1, but the metadata claims it's in orientation 8.

What you're seeing is that Preview (i.e. ImageKit) interprets the
orientation and thus gets displays it 'correctly' given the
corruption, while NSBitmapImageRep does not.

Most apps that post-process an image to put it into orientation 1 are
also bright enough to remove the metadata that claims it's in some
other orientation.  Unfortunately, not whatever has been used to
process this image!

-Ken







Jean-Nicolas Jolivet

On 12-Dec-08, at 5:20 PM, Ken Ferry wrote:

Hi Jean-Nicolas,

Could you send me one of these auto-rotated images? NSBitmapImageRep
does not do any automatic orientation correction in 10.5. Is it
possible that your Canon camera is writing out an already-rotated file
in orientation 1?


If ImageIO is doing automatic orientation correction for certain RAW
formats (which would be news to me), then it should report 1 for the
orientation, since it's already been handled.

-Ken
Cocoa Frameworks

On Fri, Dec 12, 2008 at 1:55 PM, Jean-Nicolas Jolivet
<email@hidden> wrote:

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@hidden
http://www.silverscripting.com

_______________________________________________

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


Jean-Nicolas Jolivet email@hidden http://www.silverscripting.com




Jean-Nicolas Jolivet email@hidden http://www.silverscripting.com

_______________________________________________

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: 
 >NSBitmapImageRep orientation? (From: Jean-Nicolas Jolivet <email@hidden>)
 >Re: NSBitmapImageRep orientation? (From: "Ken Ferry" <email@hidden>)
 >Re: NSBitmapImageRep orientation? (From: "Ken Ferry" <email@hidden>)

  • Prev by Date: Re: NSBitmapImageRep orientation?
  • Next by Date: Re: - [NSBitmapImageRep tiffRepresentation] malloc error
  • Previous by thread: Re: NSBitmapImageRep orientation?
  • Next by thread: Funky behavior with layer-backed views
  • Index(es):
    • Date
    • Thread