Monday, 5 September 2011

How to treat Photo Orientation using ExifInterface

ExifInterface exif = null;
int iOrientation = ExifInterface.ORIENTATION_NORMAL;
try {
    exif = new ExifInterface(image_path);
     iOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

switch(iOrientation) {
    case ExifInterface.ORIENTATION_NORMAL:
        break;
    case ExifInterface.ORIENTATION_ROTATE_90:
        break;
    case ExifInterface.ORIENTATION_ROTATE_180:
        break;
    case ExifInterface.ORIENTATION_ROTATE_270:
        break;
}

No comments:

Post a Comment