public static RotateBitmapResult rotateBitmapByExif(Bitmap bitmap,Context context,Uri uri){
  try {
    File file=getFileFromUri(context,uri);
    if (file.exists()) {
      ExifInterface ei=new ExifInterface(file.getAbsolutePath());
      return rotateBitmapByExif(bitmap,ei);
    }
  }
 catch (  Exception ignored) {
  }
  return new RotateBitmapResult(bitmap,0);
}

public static RotateBitmapResult rotateBitmapByExif ( Bitmap bitmap , Context context , Uri uri ) { try { File file = getFileFromUri ( context , uri ) ; if ( file . exists ( ) ) { ExifInterface ei = new ExifInterface ( file . getAbsolutePath ( ) ) ; return rotateBitmapByExif ( bitmap , ei ) ; } } catch ( Exception ignored ) { } return new RotateBitmapResult ( bitmap , 0 ) ; }
rotate the given image by reading the exif value of the image ( uri ) . < br > if no rotation is required the image will not be rotated . < br > new bitmap is created and the old one is recycled .
