iPhone SDK: Wrong image orientation

Started by jose13 replies15 views
joseOriginal post
#1

Archived from the Transloadit support forum. Originally posted on May 4, 2011; details may be outdated, see our docs for current behavior. Original thread

Hi, I’m using your iPhone SDK to upload images. I followed the example and, after using the UIImageViewController to take a photo, I added the picked file like so:

[transload addPickedFile:info]; // info => the NSDictionary returned by the didFinishPickingMediaWithInfo method.

The problem is that, the result image is always in landscape mode, even if I take the picture in portrait mode.

What am I doing wrong? Is this a known issue? Can it be circumvented?

Thanks for your help.

tim-kos
#2

Hey Jose,

we do support automatic rotation for miss-rotated photos, so it might be a thing specific to your situation. Can you upload the image (with all metadata on it) in here? Then we can investigate.

Kind regards,
Tim

jose
#3

Hey TIm,

Ok this is the step by step process of what I’m doing.

  1. Using an UIImagePickerController, I take a picture using the iPhone camera in portrait mode (just holding the iPhone in the default position).

  2. Step 1 triggers the didFinishPickingMediaWithInfo:(NSDictionary*)info delegate method. The info dictionary contains the following data:

{
    UIImagePickerControllerMediaMetadata =     {
        DPIHeight = 72;
        DPIWidth = 72;
        Orientation = 6;
        "{Exif}" =         {
            ColorSpace = 1;
            DateTimeDigitized = "2011:05:05 10:25:36";
            DateTimeOriginal = "2011:05:05 10:25:36";
            PixelXDimension = 1536;
            PixelYDimension = 2048;
        };
        "{TIFF}" =         {
            DateTime = "2011:05:05 10:25:36";
            Make = Apple;
            Model = "iPhone 3GS";
            Software = "4.3.3";
            XResolution = 72;
            YResolution = 72;
        };
    };
    UIImagePickerControllerMediaType = "public.image";
    UIImagePickerControllerOriginalImage = "<UIImage: 0x455aff0>";
}

Notice the Orientation value, which is 6 => Portrait.

  1. I create a TransloaditRequest object, and add the picked file info like so: [transload addPickedFile:info]. The template I use does the following:
{ "steps": {
    "small": {
      "robot": "/image/resize",
      "use": ":original",
      "width": 190,
      "height": 256
    },
    "export": {
      "robot": "/s3/store",
      "use": "small",
      "key": "...",
      "secret": "...",
      "bucket": "...",
      "path": "${previous_step.name}.jpg"
    }
} }
  1. When the request finishes and all is done, the image stored in our S3 bucket is in landscape (left) orientation.

Is there a way I can manipulate the image before adding it to the TransloaditRequest object?

Thanks for your help.

tim-kos
#4

Hm that sounds weird.

Can you attach the image in question to this support ticket? Then I can check its exif data to see if it contains a format that we do not recognize for the auto-rotation.

Thanks
Tim

Jose_E_Bolanos
#5

I’ve attached the images. Thanks

tim-kos
#6

Hm, both show as portrait images for in the browser.

Are you sure, these are the right images?

jose
#7

Well, when attached here, somehow it was converted to the correct orientation, but the original file is incorrect. See attachment. Thanks.

tim-kos
#9

Great to hear!

Kind regards,
Tim

Felix_Geisendorfer
#10

Jose: Is this something that would be convenient for you if it was done by our SDK? If so, feel free to make the change in a fork of the SDK and I’ll merge it in!

tim-kos
#11

Closing this for now.

Jose, please feel free to reopen the ticket if you are going to reply to Felix’ question.

tim-kos
#12

Btw, we also support auto-rotation fixes for images now.

jose
#13

Thank you! Sorry for not replying before. I will try the new sdk, to see if my fix is no longer necessary.

tim-kos
#14

Great. Closing this now.