Code example for ExifInterface

Methods: getAttributeInt

2
     * @return 
     * @throws IOException 
     */ 
    public static int getOrientationInDegreesForFileName(String fileName) throws IOException
    { 
        ExifInterface exif = new ExifInterface(fileName);
        int rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        int rotationInDegrees = exifToDegrees(rotation);
        return rotationInDegrees;
    } 
 
    /** 
     * Convert exif orientation information to degrees. 
     * Idea and code taken from http://stackoverflow.com/a/11081918/527759 
     *  
     * @param exifOrientation 
     * @return 
     */ 
    private static int exifToDegrees(int exifOrientation) {