List of usage examples for android.media ExifInterface ORIENTATION_ROTATE_270
int ORIENTATION_ROTATE_270
To view the source code for android.media ExifInterface ORIENTATION_ROTATE_270.
Click Source Link
From source file:Main.java
public static Bitmap fixBitmapOrientation(Uri uri, Bitmap bmp) throws IOException { ExifInterface ei = new ExifInterface(uri.getPath()); int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: return rotateBitmap(bmp, 90); case ExifInterface.ORIENTATION_ROTATE_180: return rotateBitmap(bmp, 180); case ExifInterface.ORIENTATION_ROTATE_270: return rotateBitmap(bmp, 270); }//w w w. j a va2 s . co m return bmp; }
From source file:Main.java
public static int getRotation(String jpegFilePath) { int degrees = 0; try {/*from www . j a v a2 s.c o m*/ ExifInterface exifInterface = new ExifInterface(jpegFilePath); int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degrees = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degrees = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degrees = 270; break; } } catch (IOException e) { e.printStackTrace(); } return degrees; }
From source file:Main.java
public static int getCameraPhotoOrientation(Context context, Uri imageUri, String imagePath) { int rotate = 0; try {//from w w w . j a v a 2 s.c o m context.getContentResolver().notifyChange(imageUri, null); File imageFile = new File(imagePath); ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath()); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_270: rotate = 270; break; case ExifInterface.ORIENTATION_ROTATE_180: rotate = 180; break; case ExifInterface.ORIENTATION_ROTATE_90: rotate = 90; break; } } catch (Exception e) { e.printStackTrace(); } return rotate; }
From source file:Main.java
public static Matrix rotateImage(Context context, Uri imageUri, File f) { Matrix matrix = new Matrix(); try {/*from w w w.j a v a 2s . c o m*/ if (imageUri != null) { context.getContentResolver().notifyChange(imageUri, null); } ExifInterface exif = new ExifInterface(f.getAbsolutePath()); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_270: matrix.postRotate(270); break; case ExifInterface.ORIENTATION_ROTATE_180: matrix.postRotate(180); break; case ExifInterface.ORIENTATION_ROTATE_90: matrix.postRotate(90); break; } } catch (Exception e) { e.printStackTrace(); } return matrix; }
From source file:Main.java
public static Bitmap getTotateBitmap(Bitmap bitmap, int orientation) { Matrix matrix = new Matrix(); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: { matrix.setRotate(90);//from w w w.j a va2 s . co m bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } break; case ExifInterface.ORIENTATION_ROTATE_180: { matrix.setRotate(180); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } break; case ExifInterface.ORIENTATION_ROTATE_270: { matrix.setRotate(270); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } break; default: break; } return bitmap; }
From source file:Main.java
public static int getExifOrientation(String filepath) { int degree = 0; ExifInterface exif = null;/*from www .j a v a 2s .com*/ try { exif = new ExifInterface(filepath); } catch (IOException ex) { } if (exif != null) { int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); if (orientation != -1) { switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degree = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 270; break; } } } return degree; }
From source file:Main.java
public static int getExifOrientation(String filepath) { int degree = 0; try {/* w ww . j av a2s . c o m*/ ExifInterface exif = new ExifInterface(filepath); if (exif != null) { int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); if (orientation != -1) { switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degree = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 90; break; } } } return degree; } catch (IOException ex) { Log.e("ExifOrientation", "cannot read exif", ex); } return degree; }
From source file:Main.java
/** * Get the # of degrees an image must be rotated to match the given exif orientation. * * @param exifOrientation The exif orientation [1-8] * @return the number of degrees to rotate */// w w w . j a v a 2 s .com public static int getExifOrientationDegrees(int exifOrientation) { final int degreesToRotate; switch (exifOrientation) { case ExifInterface.ORIENTATION_TRANSPOSE: case ExifInterface.ORIENTATION_ROTATE_90: degreesToRotate = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: degreesToRotate = 180; break; case ExifInterface.ORIENTATION_TRANSVERSE: case ExifInterface.ORIENTATION_ROTATE_270: degreesToRotate = 270; break; default: degreesToRotate = 0; } return degreesToRotate; }
From source file:Main.java
/** * Get the # of degrees an image must be rotated to match the given exif orientation. * * @param exifOrientation The exif orientation [1-8] * @return the number of degrees to rotate *//*w w w.j av a 2s .co m*/ public static int getExifOrientationDegrees(int exifOrientation) { final int degreesToRotate; switch (exifOrientation) { case ExifInterface.ORIENTATION_TRANSPOSE: case ExifInterface.ORIENTATION_ROTATE_90: degreesToRotate = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: degreesToRotate = 180; break; case ExifInterface.ORIENTATION_TRANSVERSE: case ExifInterface.ORIENTATION_ROTATE_270: degreesToRotate = 270; break; default: degreesToRotate = 0; break; } return degreesToRotate; }
From source file:Main.java
/** * Extracts the EXIF rotation tag of an image file. * * @param filePath Path to the image file * @return Rotation in degrees/*from w ww. j ava 2 s. c om*/ * @throws IOException */ public static int getExifRotation(String filePath) throws IOException { ExifInterface exif = new ExifInterface(filePath); int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (exifOrientation) { case ExifInterface.ORIENTATION_ROTATE_90: return 90; case ExifInterface.ORIENTATION_ROTATE_180: return 180; case ExifInterface.ORIENTATION_ROTATE_270: return 270; default: return 0; } }