Skip to main content
Participating Frequently
March 14, 2013
Answered

CameraRoll & CameraUI image orientation

  • March 14, 2013
  • 3 replies
  • 4423 views

Hi,

I am trying to read the Orientation tag in EXIF image data grabbed with CameraRoll or CameraRollUI using AIR 3.6 on iOS 6.1

To achieve this, I use this library coded by Christian Cantrell :

http://blogs.adobe.com/cantrell/archives/2011/10/parsing-exif-data-from-images-on-mobile-devices.html

Unfortunantly, it raises an error when I try to parse the Byterray containing the EXIF data :

var exifInfo:ExifInfo = new ExifInfo( eb );


TypeError: Error #1034: Type Coercion failed: cannot convert "<tags level="0th IFD TIFF Tags">

  <tag tag_name="Image width" field_name="ImageWidth" id="0x0100" compressed="J">

    <uncompressed chunky="M" planar="M" ycc="M" />

  ... INSERT BIG CHUNK OF XML HERE ...

</tags>" to XML.

          at jp.shichiseki.exif::ExifInfo/readIFDs()[/Users/***/Google Drive/AS3/libs/jp/shichiseki/exif/ExifInfo.as:100]

          at jp.shichiseki.exif::ExifInfo()[/Users/***/Google Drive/AS3/libs/jp/shichiseki/exif/ExifInfo.as:63]

It seems that Air can't cast the data into XML, but it's kind of crazy because I am able to see all the data in the error text (I purposedly truncated it here for not flooding this post) and it's XML valid. I had a look into the ExifInfo class, but it's hard to see where the error comes from.

I really need to get access to these data, since it's the only way to determine image orientation in iOS. Or is there any native extention thaht I could use to achieve this ?

Any advice will be welcome as I am stuck on a project for a client because of this.

Thank you all !

This topic has been closed for replies.
Correct answer Colin Holgate

Essentially I gave up. For most cases the user would be taking a new picture, and that wasn't a problem. The problem case was that they would load an old picture that had been taken the opposite orientation of the app. The tool had easy ways to rotate the image, so I didn't worry so much about the problem.

3 replies

Known Participant
October 20, 2015

It's still a bug. Here's the bug reported in bugbase. Bug#4070057 - CameraRoll on iOS returns Bitmap in incorrect orientation

Participant
February 22, 2014

Hi

This is all really useful, except- the shichiseki library download doesn't seem to be available anymore. lt's returning 403 forbidden. Is it just me? Can anyone help with that?

Thank you

Colin Holgate
Inspiring
February 22, 2014

Can you take this example project? Use the Download Zip button over in the lower right of the page:

https://github.com/cantrell/ExifExample

Participant
February 23, 2014

Colin that's great thanks, I now have access to the library and the example Flash Builder project.  All I have to do now is get it all working with my code!

Colin Holgate
Inspiring
March 14, 2013

I looked at that for a while, and although I didn't get errors, I also didn't get orientation information on iOS. I didn't try Android, because I was doing this just for iOS at the time.

Participating Frequently
March 14, 2013

Well I am a  bit luckier on this since I am able to see the data in the console panel in FB, but embeded in the error :

<tag tag_name="Orientation of image" field_name="Orientation" id="0x0112" compressed="R">

    <uncompressed chunky="R" planar="R" ycc="R" />

</tag>

Did you succed with an other method or did you gave up ?

Colin Holgate
Colin HolgateCorrect answer
Inspiring
March 14, 2013

Essentially I gave up. For most cases the user would be taking a new picture, and that wasn't a problem. The problem case was that they would load an old picture that had been taken the opposite orientation of the app. The tool had easy ways to rotate the image, so I didn't worry so much about the problem.