Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.media.ExifInterface; public class Main { public static int getRotationFromExif(Context context, String bitmapPath) { try { ExifInterface ei = new ExifInterface(bitmapPath); int exifOrientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); switch (exifOrientation) { case ExifInterface.ORIENTATION_ROTATE_90: return 90; case ExifInterface.ORIENTATION_ROTATE_180: return 180; case ExifInterface.ORIENTATION_ROTATE_270: return 270; case ExifInterface.ORIENTATION_NORMAL: return 0; } } catch (Exception e) { } return -1; } }