一般情况下相机拍照之后产生的图片默认旋转角度为0,但是在读取相册的时候会出现部分手机中的部分照片被自动旋转的问题,目前发现三星手机会出现这种问题;如果还有其他手机也出现此类问题的可以留言告诉我!
如果发现相片被旋转的话,可以通过以下方法获取图片被旋转的角度:
/** * 读取图片属性:旋转的角度 * * @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) {