Android 拍照 图片 颠倒90度
生活随笔
收集整理的這篇文章主要介紹了
Android 拍照 图片 颠倒90度
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
如題遇到一問題???想必大家都會遇到??:
網上搜了很多方法都行不通???手上有各種手機??反正到了三星I9300?這里就不行了
下面的方法行不通
/**
*?讀取圖片屬性:旋轉的角度
*?@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;
}
網上搜了很多方法都行不通???手上有各種手機??反正到了三星I9300?這里就不行了
下面的方法行不通
/**
*?讀取圖片屬性:旋轉的角度
*?@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;
}
總結
以上是生活随笔為你收集整理的Android 拍照 图片 颠倒90度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java将图片压缩为原来的一半
- 下一篇: Android开发拍照图片旋转