當前位置: 首頁>>代碼示例>>Java>>正文


Java ExifInterface.ORIENTATION_ROTATE_270屬性代碼示例

本文整理匯總了Java中android.media.ExifInterface.ORIENTATION_ROTATE_270屬性的典型用法代碼示例。如果您正苦於以下問題:Java ExifInterface.ORIENTATION_ROTATE_270屬性的具體用法?Java ExifInterface.ORIENTATION_ROTATE_270怎麽用?Java ExifInterface.ORIENTATION_ROTATE_270使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.media.ExifInterface的用法示例。


在下文中一共展示了ExifInterface.ORIENTATION_ROTATE_270屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: rotateBitmapByExif

/**
 * Rotate the given image by given Exif value.<br>
 * If no rotation is required the image will not be rotated.<br>
 * New bitmap is created and the old one is recycled.
 */
static RotateBitmapResult rotateBitmapByExif(Bitmap bitmap, ExifInterface exif) {
    int degrees;
    int orientation = exif.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;
        default:
            degrees = 0;
            break;
    }
    return new RotateBitmapResult(bitmap, degrees);
}
 
開發者ID:chuch0805,項目名稱:Android-Demo_ImageCroper,代碼行數:24,代碼來源:BitmapUtils.java

示例2: getOrientationFromExifInterface

private int getOrientationFromExifInterface(Uri uri) {
    try {
        ExifInterface exif = new ExifInterface(uri.getPath());
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
        switch (orientation) {
            case ExifInterface.ORIENTATION_ROTATE_270:
                return 270;
            case ExifInterface.ORIENTATION_ROTATE_180:
                return 180;
            case ExifInterface.ORIENTATION_ROTATE_90:
                return 90;
            case ExifInterface.ORIENTATION_NORMAL:
                return 0;
            default:
                return -1;
        }
    } catch (IOException e) {
        return -1;
    }
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:20,代碼來源:NewTagFragment.java

示例3: readPictureDegree

/**
 * 讀取圖片屬性:旋轉的角度
 * @param path 圖片絕對路徑
 * @return degree旋轉的角度
 */
public static int readPictureDegree(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(
                ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        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;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
開發者ID:Louis19910615,項目名稱:youkes_browser,代碼行數:28,代碼來源:HelpUtils.java

示例4: exifToDegrees

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;
}
 
開發者ID:BrandonVargas,項目名稱:AndroidOCRFforID,代碼行數:20,代碼來源:BitmapLoadUtils.java

示例5: getPicRotate

/**
 * 讀取圖片文件旋轉的角度
 *
 * @param path 圖片絕對路徑
 * @return 圖片旋轉的角度
 */
public static int getPicRotate(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        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;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
開發者ID:StickyTolt,項目名稱:ForeverLibrary,代碼行數:27,代碼來源:PictureUtil.java

示例6: rotatingImage

private Bitmap rotatingImage(Bitmap bitmap) {
    if (srcExif == null) return bitmap;

    Matrix matrix = new Matrix();
    int angle = 0;
    int orientation = srcExif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
    switch (orientation) {
        case ExifInterface.ORIENTATION_ROTATE_90:
            angle = 90;
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            angle = 180;
            break;
        case ExifInterface.ORIENTATION_ROTATE_270:
            angle = 270;
            break;
    }

    matrix.postRotate(angle);

    return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}
 
開發者ID:hushengjun,項目名稱:FastAndroid,代碼行數:22,代碼來源:CompressEngine.java

示例7: getImageSpinAngle

/**
 * obtain the image rotation angle
 *
 * @param path path of target image
 */
private int getImageSpinAngle(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        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;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return degree;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:26,代碼來源:Luban.java

示例8: readPictureDegree

/**
 * 讀取圖片屬性:旋轉的角度
 *
 * @param path 圖片絕對路徑
 * @return degree旋轉的角度
 */
public static int readPictureDegree(String path) {
    int degree = 0;
    try {
        ExifInterface exifInterface = new ExifInterface(path);
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        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;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
開發者ID:JJS-CN,項目名稱:JBase,代碼行數:27,代碼來源:PictureUtils.java

示例9: getBitmapDegree

/**
 * 讀取圖片的旋轉的角度
 *
 * @param path 圖片絕對路徑
 * @return 圖片的旋轉角度
 */
public static int getBitmapDegree(String path) {
    int degree = 0;
    try {
        // 從指定路徑下讀取圖片,並獲取其EXIF信息
        ExifInterface exifInterface = new ExifInterface(path);
        // 獲取圖片的旋轉信息
        int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_NORMAL);
        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;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return degree;
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:30,代碼來源:ImageUtils.java

示例10: getOrientation

public static int getOrientation(final String imagePath) {
    int rotate = 0;
    try {
        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;
}
 
開發者ID:viseator,項目名稱:MontageCam,代碼行數:23,代碼來源:BitmapUtils.java

示例11: setOrientation

public void setOrientation() throws IOException {
    if (TextUtils.isEmpty(getAbsoluteImagePath())) {
        return;
    }
    BitmapFactory.Options bmOptions = new BitmapFactory.Options();
    Bitmap bitmap = BitmapFactory.decodeFile(getAbsoluteImagePath(), bmOptions);

    ExifInterface ei = new ExifInterface(getAbsoluteImagePath());
    int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,
            ExifInterface.ORIENTATION_UNDEFINED);

    switch (orientation) {

        case ExifInterface.ORIENTATION_ROTATE_90:
            writeFile(rotateImage(bitmap, 90));
            break;
        case ExifInterface.ORIENTATION_ROTATE_180:
            writeFile(rotateImage(bitmap, 180));
            break;

        case ExifInterface.ORIENTATION_ROTATE_270:
            writeFile(rotateImage(bitmap, 270));
            break;

        case ExifInterface.ORIENTATION_NORMAL:

        default:
            break;
    }
}
 
開發者ID:BANKEX,項目名稱:smart-asset-iot-android-demo,代碼行數:30,代碼來源:ImageUtils.java

示例12: exifToDegrees

private 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;
    } else {
        return 0;
    }
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:11,代碼來源:CameraLauncher.java

示例13: getOrientation

public int getOrientation() {
    int o = Integer.parseInt(this.orientation);

    if (o == ExifInterface.ORIENTATION_NORMAL) {
        return 0;
    } else if (o == ExifInterface.ORIENTATION_ROTATE_90) {
        return 90;
    } else if (o == ExifInterface.ORIENTATION_ROTATE_180) {
        return 180;
    } else if (o == ExifInterface.ORIENTATION_ROTATE_270) {
        return 270;
    } else {
        return 0;
    }
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:15,代碼來源:ExifHelper.java

示例14: getRotateAngle

/**
 * 獲取圖片旋轉角度
 *
 * @param filePath
 * @return
 */
public static int getRotateAngle(String filePath) {
    int angle = 0;
    try {
        ExifInterface exif = new ExifInterface(filePath);
        int orientation = exif.getAttributeInt(
                ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_UNDEFINED);
        switch (orientation) {
            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;
        }
    } catch (Throwable ex) {
        LogUtil.e(ex.getMessage(), ex);
    }
    return angle;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:32,代碼來源:ImageDecoder.java

示例15: shouldRotate

private static boolean shouldRotate(ContentResolver resolver, Uri uri) {
    ExifInterface exif;
    try {
        exif = ExifInterfaceCompat.newInstance(getPath(resolver, uri));
    } catch (IOException e) {
        Log.e(TAG, "could not read exif info of the image: " + uri);
        return false;
    }
    int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
    return orientation == ExifInterface.ORIENTATION_ROTATE_90
            || orientation == ExifInterface.ORIENTATION_ROTATE_270;
}
 
開發者ID:sathishmscict,項目名稱:Matisse-Image-and-Video-Selector,代碼行數:12,代碼來源:PhotoMetadataUtils.java


注:本文中的android.media.ExifInterface.ORIENTATION_ROTATE_270屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。