Android examples for Graphics:Bitmap Orientation
get the orientation of the bitmap android.media.ExifInterface
//package com.java2s; import android.media.ExifInterface; import java.io.IOException; public class Main { /**// w ww. j av a 2s.c om * get the orientation of the bitmap {@link android.media.ExifInterface} * * @param path * @return */ public final static int getDegress(String path) { int degree = 0; try { ExifInterface exifInterface = new ExifInterface(path); int orientation = exifInterface.getAttributeInt( ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degree = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 270; break; } } catch (IOException e) { e.printStackTrace(); } return degree; } }