Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- ExifInterface exifInterface = new ExifInterface(path);
- int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
- int rotation = 0;
- switch (orientation){
- case ExifInterface.ORIENTATION_ROTATE_90 :
- rotation = 90;
- break;
- case ExifInterface.ORIENTATION_ROTATE_180 :
- rotation = 180;
- break;
- case ExifInterface.ORIENTATION_ROTATE_270 :
- rotation = 270;
- break;
- default: break;
- }
- Matrix matrix = new Matrix();
- matrix.postRotate(rotation);
- decode = BitmapFactory.decodeFile(path, options);
- rotatedBitmap = Bitmap.createBitmap(decode, 0, 0, decode.getWidth(), decode.getHeight(), matrix, true);
- } catch (IOException e){
- Log.d("ROTATION ERROR", e.getCause() + " " + e.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment