Java tutorial
//package com.java2s; import java.io.IOException; import android.graphics.Matrix; import android.media.ExifInterface; public class Main { public static Matrix getRotateMatrix(String s) { Matrix matrix = new Matrix(); String s1 = getPicOrientation(s); if (s1.equals("3")) matrix.setRotate(180F); else if (s1.equals("6")) matrix.setRotate(90F); else if (s1.equals("8")) matrix.setRotate(270F); else matrix.setRotate(0.0F); return matrix; } private static String getPicOrientation(String s) { try { return (new ExifInterface(s)).getAttribute("Orientation"); } catch (IOException e) { return "1"; } } }