Android调用系统拍照 读取选择的角度

来源:互联网 发布:淘宝html5模板 编辑:程序博客网 时间:2024/06/07 20:16

Android调用系统拍照 读取选择的角度

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;}
0 0
原创粉丝点击