5

I am working on an Android app that uses the phone's camera. When the picture is taken in a "standard orientation" (bottom of phone at the bottom or bottom of the phone to the right), the image received is as expected. On some phones, when the picture is taken in a "non-standard orientation" (bottom of the phone at the top or bottom of the phone to the left), the image received is upside down. On some phones, the camera application actually handles this and returns the image the expected way.

My question is, since it seems to depend on the phone (manufacturer), is there a way to detect this and rotate the image as need without having to keep a hard coded list of phone types?

  • 1
    Have you looked at the EXIF tags to see if the actual capture orientation is captured correctly there? It could be a matter of not interpreting that data correctly when displaying... Just a thought. – SEngstrom Dec 16 '10 at 22:29
  • 1
    I have been working with the EXIF tags. When the picture is taken most of the EXIF tags are set but the orientation one is 'undefined'. – Cameron Ediger Dec 22 '10 at 13:30

1 Answers1

5

You will need to set the rotation on the camera device in order to get the correctly rotated image. Try using -

public void setRotation (int rotation)

Check the sample code provided here

bluefalcon
  • 4,225
  • 1
  • 32
  • 41