Skip to main content
Inspiring
March 30, 2013
Question

Storing a photo in iOS Camera Roll

  • March 30, 2013
  • 9 replies
  • 2461 views

Hi,

as we know taking a photo with CameraUI does not store the image directly into Camera Roll.

I encounter rotation problems when storing such a photo with

cameraRoll.addBitmapData(bitmapData);

if the device was not in landscape mode when the image was taken.

I just tried the various solutions found when googling, where all of them fail on my iPad3 and iOS 6:

All of these solutions are quite outdated, therefore i'm wondering if there is a solution that works with most recent iOS devices and OS versions ?

Alternatively i could write an ANE that would receive the taken photo as BitmapData or ByteArray (hopefully with the EXIF info included) and therefore store the image correctly oriented

in Camera Roll.

If someone knows a solution that works fine please let me know. Thank you.

This topic has been closed for replies.

9 replies

April 23, 2013

Hey there,

I remember the trouble with the exif-Apis, none of them worked for me.

I fixed one of them by commenting a single line of code (thisk it was your first link).

The reason was: seems jpgs can also contain thumnaildata in the first 64k.

If there is exif info, but no thumbnail, the author erroneously returned no exif-orientation.

Fix that in Class "ExifReader", function "processData":

snip:

//Read thumbnail

if(m_thumbnailData){

    ....

}

else

{

          // EDIT HERE -----> continue without thumbnail.

          // stop(); < ---------

}

Participating Frequently
April 23, 2013

valley t, my issue is I'm dealing with the camera roll, so I need the info after the fact for this project, but I hadn't seen that link there and will check that out.

verdave, the first link is a dead link now but I'll play around with your suggestion as well.

Thanks!

Participating Frequently
April 23, 2013

verdave / valley t,

I believe I have got the class functioning as I have a valid ExifReader object now, however, I'm unsure of how to access the information I'm after. Could one of you provide an example of how to obtain the orientation after having created the ExifReader object?

Participating Frequently
April 23, 2013

I've been looking for a solution to this problem as well and ran across the same links. Were you able to resolve the issue and if so, would you mind sharing?

valley tAuthor
Inspiring
April 23, 2013

Since i didn't find a solution i solved it with these steps:

  • using this tiny GitHub project: https://github.com/fogAndWhisky/StarlingCamera
  • when shooting a photo i determine the device's orientation at that time (stage.deviceOrientation)
  • with that information after the photo has been taken i'm able to translate/rotate that image (if needed) with a matrix and finally can send the BitmapData object to the CameraRoll for storing, which works fine