Java tutorial
//package com.java2s; import android.media.ExifInterface; public class Main { public static int getOrientationFromExif(String imagePath) { int orientation = 0; try { ExifInterface exif = new ExifInterface(imagePath); int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (exifOrientation) { case ExifInterface.ORIENTATION_ROTATE_270: orientation = 270; break; case ExifInterface.ORIENTATION_ROTATE_180: orientation = 180; break; case ExifInterface.ORIENTATION_ROTATE_90: orientation = 90; break; case ExifInterface.ORIENTATION_NORMAL: orientation = 0; break; default: break; } } catch (Exception e) { } return orientation; } }