Java Code Examples for androidx.exifinterface.media.ExifInterface#ORIENTATION_FLIP_VERTICAL
The following examples show how to use
androidx.exifinterface.media.ExifInterface#ORIENTATION_FLIP_VERTICAL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitmapLoadUtils.java From EasyPhotos with Apache License 2.0 | 6 votes |
public static int exifToDegrees(int exifOrientation) { int rotation; switch (exifOrientation) { case ExifInterface.ORIENTATION_ROTATE_90: case ExifInterface.ORIENTATION_TRANSPOSE: rotation = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: rotation = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: case ExifInterface.ORIENTATION_TRANSVERSE: rotation = 270; break; default: rotation = 0; } return rotation; }
Example 2
Source File: BitmapLoadUtils.java From PictureSelector with Apache License 2.0 | 6 votes |
public static int exifToDegrees(int exifOrientation) { int rotation; switch (exifOrientation) { case ExifInterface.ORIENTATION_ROTATE_90: case ExifInterface.ORIENTATION_TRANSPOSE: rotation = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: rotation = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: case ExifInterface.ORIENTATION_TRANSVERSE: rotation = 270; break; default: rotation = 0; } return rotation; }
Example 3
Source File: CameraUtils.java From Lassi-Android with MIT License | 5 votes |
public static int readExifOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orientation = 180; break; case ExifInterface.ORIENTATION_ROTATE_90: case ExifInterface.ORIENTATION_TRANSPOSE: orientation = 90; break; case ExifInterface.ORIENTATION_ROTATE_270: case ExifInterface.ORIENTATION_TRANSVERSE: orientation = 270; break; default: orientation = 0; } return orientation; }
Example 4
Source File: BitmapLoadUtils.java From EasyPhotos with Apache License 2.0 | 5 votes |
public static int exifToTranslation(int exifOrientation) { int translation; switch (exifOrientation) { case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: case ExifInterface.ORIENTATION_FLIP_VERTICAL: case ExifInterface.ORIENTATION_TRANSPOSE: case ExifInterface.ORIENTATION_TRANSVERSE: translation = -1; break; default: translation = 1; } return translation; }
Example 5
Source File: BitmapLoadUtils.java From PictureSelector with Apache License 2.0 | 5 votes |
public static int exifToTranslation(int exifOrientation) { int translation; switch (exifOrientation) { case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: case ExifInterface.ORIENTATION_FLIP_VERTICAL: case ExifInterface.ORIENTATION_TRANSPOSE: case ExifInterface.ORIENTATION_TRANSVERSE: translation = -1; break; default: translation = 1; } return translation; }
Example 6
Source File: ImageHelper.java From FairEmail with GNU General Public License v3.0 | 4 votes |
static Matrix getImageRotation(File file) { try { ExifInterface exif = new ExifInterface(file.getAbsolutePath()); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); Matrix matrix = new Matrix(); switch (orientation) { case ExifInterface.ORIENTATION_NORMAL: return null; case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: matrix.setScale(-1, 1); return matrix; case ExifInterface.ORIENTATION_FLIP_VERTICAL: matrix.setRotate(180); matrix.postScale(-1, 1); return matrix; case ExifInterface.ORIENTATION_TRANSPOSE: matrix.setRotate(90); matrix.postScale(-1, 1); return matrix; case ExifInterface.ORIENTATION_TRANSVERSE: matrix.setRotate(-90); matrix.postScale(-1, 1); return matrix; case ExifInterface.ORIENTATION_ROTATE_90: matrix.setRotate(90); return matrix; case ExifInterface.ORIENTATION_ROTATE_180: matrix.setRotate(180); return matrix; case ExifInterface.ORIENTATION_ROTATE_270: matrix.setRotate(-90); return matrix; default: return null; } } catch (Throwable ex /* IOException */) { /* java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000 java.lang.RuntimeException: setDataSourceCallback failed: status = 0x80000000 at android.media.MediaMetadataRetriever._setDataSource(Native Method) at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:226) at androidx.exifinterface.media.ExifInterface.getHeifAttributes(SourceFile:5716) at androidx.exifinterface.media.ExifInterface.loadAttributes(SourceFile:4556) at androidx.exifinterface.media.ExifInterface.initForFilename(SourceFile:5195) at androidx.exifinterface.media.ExifInterface.<init>(SourceFile:3926) */ Log.w(ex); return null; } }
Example 7
Source File: PhotoEditorActivity.java From react-native-photo-editor with Apache License 2.0 | 4 votes |
private static Bitmap rotateBitmap(Bitmap bitmap, int orientation, boolean reverse) { Matrix matrix = new Matrix(); switch (orientation) { case ExifInterface.ORIENTATION_NORMAL: return bitmap; case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: matrix.setScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_180: matrix.setRotate(180); break; case ExifInterface.ORIENTATION_FLIP_VERTICAL: matrix.setRotate(180); matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_TRANSPOSE: if (!reverse) { matrix.setRotate(90); } else { matrix.setRotate(-90); } matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_90: if (!reverse) { matrix.setRotate(90); } else { matrix.setRotate(-90); } break; case ExifInterface.ORIENTATION_TRANSVERSE: if (!reverse) { matrix.setRotate(-90); } else { matrix.setRotate(90); } matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_270: if (!reverse) { matrix.setRotate(-90); } else { matrix.setRotate(90); } break; default: return bitmap; } try { Bitmap bmRotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); bitmap.recycle(); return bmRotated; } catch (OutOfMemoryError e) { e.printStackTrace(); return null; } }
Example 8
Source File: UiUtils.java From tindroid with Apache License 2.0 | 4 votes |
@NonNull static Bitmap rotateBitmap(@NonNull Bitmap bmp, int orientation) { Matrix matrix = new Matrix(); switch (orientation) { case ExifInterface.ORIENTATION_NORMAL: return bmp; case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: matrix.setScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_180: matrix.setRotate(180); break; case ExifInterface.ORIENTATION_FLIP_VERTICAL: matrix.setRotate(180); matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_TRANSPOSE: matrix.setRotate(90); matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_90: matrix.setRotate(90); break; case ExifInterface.ORIENTATION_TRANSVERSE: matrix.setRotate(-90); matrix.postScale(-1, 1); break; case ExifInterface.ORIENTATION_ROTATE_270: matrix.setRotate(-90); break; default: return bmp; } try { Bitmap rotated = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true); bmp.recycle(); return rotated; } catch (OutOfMemoryError ex) { Log.e(TAG, "Out of memory while rotating bitmap"); return bmp; } }