首页 > 移动平台 > 详细

android获取图片的旋转角度

时间:2014-08-20 22:47:13      阅读:683      评论:0      收藏:0      [点我收藏+]
public static int getExifOrientation(String filepath) {
    int degree = 0;
    ExifInterface exif = null;
    try {
        exif = new ExifInterface(filepath);
    } catch (IOException ex) {
    	Log.d(TAG, "cannot read exif" + 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;
}


android获取图片的旋转角度

android获取图片的旋转角度,布布扣,bubuko.com

android获取图片的旋转角度

原文:http://blog.csdn.net/tao_zi7890/article/details/38712371

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!