0

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?

EmJiHash
  • 623
  • 9
  • 22
deimos1988
  • 5,896
  • 7
  • 41
  • 57
  • Check out this : http://stackoverflow.com/questions/24128346/getting-rotation-from-exifinterface-always-returns-0/24219714#24219714 – Haresh Chhelana Aug 01 '14 at 09:24
  • @Haresh This is pretty much what I tried, the problem is that I am getting the wrong orientation information from the ExifInterface? – deimos1988 Aug 01 '14 at 09:26

0 Answers0