三星等手机拍照选取图片,图片反转的问题
来源:互联网 发布:房产数据哪个好 编辑:程序博客网 时间:2024/03/29 17:13
/**
* 得到 图片旋转 的角度
* @param filepath
* @return
*/
private int getExifOrientation(String filepath) {
int degree = 0;
ExifInterface exif = null;
try {
exif = new ExifInterface(filepath);
} catch (IOException ex) {
Log.e("test", "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;
}
int angle= getExifOrientation(picUri);
if(angle!=0){ //如果照片出现了 旋转 那么 就更改旋转度数
Matrix matrix = new Matrix();
matrix.postRotate(angle);
photoViewBitmap = Bitmap.createBitmap(photoViewBitmap,
0, 0, photoViewBitmap.getWidth(), photoViewBitmap.getHeight(), matrix, true);
}
* 得到 图片旋转 的角度
* @param filepath
* @return
*/
private int getExifOrientation(String filepath) {
int degree = 0;
ExifInterface exif = null;
try {
exif = new ExifInterface(filepath);
} catch (IOException ex) {
Log.e("test", "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;
}
int angle= getExifOrientation(picUri);
if(angle!=0){ //如果照片出现了 旋转 那么 就更改旋转度数
Matrix matrix = new Matrix();
matrix.postRotate(angle);
photoViewBitmap = Bitmap.createBitmap(photoViewBitmap,
0, 0, photoViewBitmap.getWidth(), photoViewBitmap.getHeight(), matrix, true);
}
0 0
- 三星等手机拍照选取图片,图片反转的问题
- android解决三星手机拍照获取图片的问题
- 三星手机拍照,图片旋转问题的解决
- 解决三星手机拍照后裁剪图片时横屏问题
- 三星手机拍照后显示图片角度旋转问题的解决方法
- 三星手机拍照后 图片翻转
- 解决三星手机拍照后,图片旋转。
- 三星手机拍照图片自动旋解决方法
- Android 三星手机拍照图片旋转处理
- 真正解决三星等手机拍照问题
- 三星手机在android中拍照时,照片反转的问题
- Android手机拍照和手机相册选取图片的工具类ImageUtils
- 手机拍照上传图片问题
- Android图片的选取和拍照
- Android解决三星手机拍照图片调用时逆时针旋转90度问题
- 关于三星手机调用系统相机拍照旋转屏导致图片数据丢失问题
- Android手机拍照或选取图库图片作为头像
- Android 拍照与从相册选取图片时,图片不显示的问题
- 2014西安全国邀请赛——题目重现(感谢西工大+复旦)HDOJ4847 Wow! Such Doge!
- Android 动画之RotateAnimation应用详解
- unity3d 带缓冲的镜头拉近效果
- 临时表和表变量、内联UDF 派生表 CTE
- mark一些代码
- 三星等手机拍照选取图片,图片反转的问题
- grep的用法
- Java源代码走读--ArrayList
- 游戏加入admob广告没显示
- 巴西队之死
- 对request.getSession(false)以及参数为true的理解
- Eclipse快捷键
- jquery给div,Span, a ,button, radio 赋值取值
- 心跳机制