Android examples for Graphics:Image Rotate
check ExIfInof of image.
//package com.java2s; import android.media.ExifInterface; import java.io.IOException; public class Main { /**/*w w w .j a v a 2 s.c om*/ * This method is use for check ExIfInof of image. * * @param mediaFile * **/ public static int checkExIfInfo(String mediaFile) { final ExifInterface exif; int rotation = 0; try { exif = new ExifInterface(mediaFile); final String exifOrientation = exif .getAttribute(ExifInterface.TAG_ORIENTATION); if (exifOrientation.equals("6")) { rotation = 90;// Rotation angle } else if (exifOrientation.equals("1")) { rotation = 0;// Rotation angle } else if (exifOrientation.equals("8")) { rotation = 270;// Rotation angle } else if (exifOrientation.equals("3")) { rotation = 180;// Rotation angle } else if (exifOrientation.equals("0")) { rotation = 0;// Rotation angle } } catch (IOException e) { e.printStackTrace(); } return rotation; } }