views:

320

answers:

1

When I take a picture with Androids camera app, it detects the phone's orientation and saves the pic accordingly. So if i take a picture of a building, the roof will be on the topside, whether I hold the phone in landscape position or portrait.

However, when i use

Intent imageCaptureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

to get a picture, the camera app doesn't react to orientation. If i hold the phone vertically (portrait), the resulting pic will be rotated, with said building's roof to the left of the screen.

How can I set the intent so that the camera will take orientation into account?

Or can I deduce in some way in what orientation the pic was taken and rotate it myself afterward?

Or any other suggestion will be greatly appreciated.

~Thanks in advance, best regards.

+1  A: 

Found the answer. The exif of the image has an indicator of the orientation. Just in case, exif can be viewed in Android like this

ExifInterface exif = new ExifInterface("filepath");
exif.getAttribute(ExifInterface.TAG_ORIENTATION);

Arcantos