Android Image Orientation Problem on Motorola Droid

Our application uses the gallery selection action to capture an image from a device in order to upload it to a new blog post. We see on the Moto Droid that the images taken in the portrait are sent back to the application in landscape orientation, so the image is sideways. AFAIK this only happens on the Droid.

This was detected through google, but we need the full size image to load in the correct orientation, so the solution does not work for us:

http://groups.google.com/group/android-developers/browse_frm/thread/1246475fd4c3fdb6?pli=1

An easy way to reproduce this is to take a picture in a portrait on the Droid, and then send it to yourself through Gmail. In the email, the image will be in horizontal (side). I tested the droid 2.1 update and the problem is still there.

Here is some more info:

I looked at the image information in Photoshop, and it has the following line:

<tiff:Orientation>1</tiff:Orientation> 

This specification ( http://www.awaresystems.be/imaging/tiff/tifftags/orientation.html ) says that the value 1 is:

1 = 0th row represents the visual top of the image and 0th column represents the visual left side.

In this case, is it wrong? The upper part of the image in my case is right, and the 0th line is left, which, in my opinion, should be the value "5" for the tiff orientation.

+4
source share
1 answer

I think this may be a bug in the server code with EXIF ​​tags. On my Droid with 2.1, I took a picture in portrait mode, as you said, and examined the saved result (for example, by email). When opening a file in Preview (on Mac), it looks right.

Using the handy exif tool ( port install exif on Mac), I was able to print the EXIF ​​information:

 $ exif -t Orientation image.jpg EXIF entry 'Orientation' (0x112, 'Orientation') exists in IFD '0': Tag: 0x112 ('Orientation') Format: 3 ('Short') Components: 1 Size: 2 Value: right - top 

Now, if you want to delete EXIF ​​information, what might happen in your connection with the server / client:

 $ exif --ifd=0 --tag=Orientation --set-value= -o image2.jpg image.jpg Wrote file 'image2.jpg'. $ exif -t Orientation image2.jpg EXIF entry 'Orientation' (0x112, 'Orientation') exists in IFD '0': Tag: 0x112 ('Orientation') Format: 3 ('Short') Components: 1 Size: 2 Value: 

The resulting image will be in landscape mode.

So, the bottom line says that I think the Droid keeps a bit in the image always in the landscape and relies on EXIF ​​metadata to store rotation information (which is absolutely true), and your application may discard this information .

Hope this helps! Feel free to comment or edit the original question for further troubleshooting.

+2
source

Source: https://habr.com/ru/post/1306061/


All Articles