15

I am taking a picture in my Samsung Galaxy SII device from the code. After saving and displaying it on the screen I see it is rotated by 90 degrees.

I understood it is some device issue - it does not happen on all devices.

I am taking the picture uskng the given camera intent and save it in onActivityResult function.

I looked around but did not find a solid solution for this.

Any ideas how can find the problem and rotate it back only on "problematic" devices?

Shirish Herwade
  • 11,461
  • 20
  • 72
  • 111
user1136875
  • 613
  • 1
  • 9
  • 22
  • answers available here https://stackoverflow.com/questions/14066038/why-does-an-image-captured-using-camera-intent-gets-rotated-on-some-devices-on-a?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Shirish Herwade May 20 '18 at 06:59

2 Answers2

9

This is a bug based on different manufacturers settings. Some phones rotate them, some don't. see the link, it's issue #1193

http://code.google.com/p/android/issues/detail?id=1193

Also answers available to correct it - Why does an image captured using camera intent gets rotated on some devices on Android?

Shirish Herwade
  • 11,461
  • 20
  • 72
  • 111
Bill Gary
  • 2,987
  • 2
  • 15
  • 19
  • So as far as I can see - I must request landscape mode from the camera? Is there a way to find out somehow if the device the application is running on is ratating it? or should I make all devices use landscape mode and block the portrait(which is not a nice solution) – user1136875 Jan 15 '12 at 07:27
  • 1
    I haven't figured out that part myself. I personally am gonna try http://developer.android.com/guide/topics/media/camera.html#custom-camera and see if that makes a difference. – Bill Gary Jan 15 '12 at 07:32
  • If you will figure it out - please let me know :) – user1136875 Jan 15 '12 at 14:06
  • 1
    The picture is always taken in the orientation the camera is built into the device. To get your image rotated correctly you'll have to read the orientation information that is stored into the picture (EXIF meta data). There it is stored how the device was oriented, when the image was taken.refer it.http://stackoverflow.com/questions/12933085/android-camera-intent-saving-image-landscape-when-taken-portrait – BABU K Feb 25 '14 at 13:51
-2

I guess it might the be the problem of your Orientation Sensor.. Do you process the sensor value in your program.. to know when the user has taken the photo the device was in horizontal or vertical orientation..

Miro Markaravanes
  • 3,285
  • 25
  • 32