Within my app I am taking a picture using the installed camera app of the phone by using
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFile(1); // create a file to save the image
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
Now in onActivityResult() I am doing:
FileInputStream fis;
try {
File imgFile = getCurrentPictureFile();
Uri uri = Uri.fromFile(imgFile);
File dest = new File(uri.getPath());
fis = new FileInputStream(dest);
Bitmap sourceBitmap = BitmapFactory.decodeStream(fis);
fileUri = getOutputMediaFile(1);
exif = new ExifInterface(fileUri.getPath().toString());
int tmp = getBitmapRotation(Integer.valueOf(exif.getAttribute(ExifInterface.TAG_ORIENTATION)));
...
}
My problem is:
I am taking a picture in portrait mode; the width of the picture is greater than the height; according to the Exif-information, the orientation is 0, so supposedly the picture is not rotated - but since the width is greater than the height, the picture IS in fact rotated.
But why does the Exif-information say otherwise?