Example usage for android.media ExifInterface ORIENTATION_ROTATE_90

List of usage examples for android.media ExifInterface ORIENTATION_ROTATE_90

Introduction

In this page you can find the example usage for android.media ExifInterface ORIENTATION_ROTATE_90.

Prototype

int ORIENTATION_ROTATE_90

To view the source code for android.media ExifInterface ORIENTATION_ROTATE_90.

Click Source Link

Usage

From source file:Main.java

private static int exifToDegrees(int exifOrientation) {
    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
        return 90;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
        return 180;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
        return 270;
    }/*w w  w.  j  a v a  2s  .com*/
    return 0;
}

From source file:Main.java

private static int exifToDegrees(int exifOrientation) {
    switch (exifOrientation) {
    case ExifInterface.ORIENTATION_ROTATE_90:
        return 90;
    case ExifInterface.ORIENTATION_ROTATE_180:
        return 180;
    case ExifInterface.ORIENTATION_ROTATE_270:
        return 270;
    default://from ww w  . ja  v  a  2 s  .  c  o m
        return 0;
    }
}

From source file:Main.java

public static float exifOrientationToDegrees(int exifOrientation) {

    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {

        return 90;

    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {

        return 180;

    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {

        return 270;

    }/*from   ww  w. j av  a2s . c om*/

    return 0;

}

From source file:Main.java

public static float getDegree(int exifOrientation) {
    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90)
        return 180;
    else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180)
        return 270;
    else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270)
        return 0;

    return 90;//from ww  w  . j  a v  a  2s .  c  om
}

From source file:Main.java

private static float exifOrientationToDegrees(int exifOrientation) {
    float angle;/*from   w  w w .j  a  v a 2  s.c  om*/
    switch (exifOrientation) {
    case ExifInterface.ORIENTATION_ROTATE_90:
        angle = 90;
        break;
    case ExifInterface.ORIENTATION_ROTATE_180:
        angle = 180;
        break;
    case ExifInterface.ORIENTATION_ROTATE_270:
        angle = 270;
        break;
    default:
        angle = 0;
        break;
    }
    return angle;
}

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  av  a 2 s  .c o  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

private static int decodeExifOrientation(int orientation) {
    switch (orientation) {
    case ExifInterface.ORIENTATION_NORMAL:
        orientation = 0;//from  ww  w  .j  av  a 2  s. c  om
        break;
    case ExifInterface.ORIENTATION_ROTATE_90:
        orientation = 90;
        break;
    case ExifInterface.ORIENTATION_ROTATE_180:
        orientation = 180;
        break;
    case ExifInterface.ORIENTATION_ROTATE_270:
        orientation = 270;
        break;
    default:
        break;
    }
    return orientation;
}

From source file:Main.java

public static int[] getBitmapRealSize(int[] size, int orientation) {
    if (size == null || size.length != 2) {
        size = new int[2];
        return size;
    }/*from  w  w  w  .j  a  v a  2  s .  co  m*/
    int w = size[0];
    int h = size[1];
    switch (orientation) {
    case ExifInterface.ORIENTATION_ROTATE_270:
    case ExifInterface.ORIENTATION_ROTATE_90:
        size[0] = h;
        size[1] = w;
        break;
    }
    return size;
}

From source file:Main.java

/**
 * Converts the given Exif Orientation to a degree for rotation.
 * /*from ww w . j av a 2  s  . c o m*/
 * @param exifOrientation
 *            the ExifInterface code for the orientation
 * @return the rotation as a <code>float</code>
 */
private static float exifOrientationToDegrees(int exifOrientation) {
    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
        return 90;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
        return 180;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
        return 270;
    }
    return 0;
}

From source file:Main.java

/**
 * Gets the Amount of Degress of rotation using the exif integer to determine how much
 * we should rotate the image./*from w  ww .  j  a  v a2 s.  c o m*/
 * @param exifOrientation - the Exif data for Image Orientation
 * @return - how much to rotate in degress
 */
private static int exifToDegrees(int exifOrientation) {
    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
        return 90;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
        return 180;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
        return 270;
    }
    return 0;
}