三星note3 拍照图片转向问题。解决oom
来源:互联网 发布:c语言基本数据类型包括 编辑:程序博客网 时间:2024/04/30 15:20
/** * 读取图片属性:旋转的角度 * * @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;}
/** * 旋转图片 * * @param angle * @param bitmap * @return Bitmap */public static Bitmap rotaingImageView(int angle, Bitmap bitmap) {// 旋转图片 动作Matrix matrix = new Matrix();matrix.postRotate(angle);System.out.println("angle2=" + angle);// 创建新的图片Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0,bitmap.getWidth(), bitmap.getHeight(), matrix, true);return resizedBitmap;}//该方法压缩显示图片和解决转向问题。
public static void setImageSrc(ImageView imageView, String imagePath,int angle) {BitmapFactory.Options option = new BitmapFactory.Options();option.inSampleSize = getImageScale(imagePath);Bitmap bm = BitmapFactory.decodeFile(imagePath, option);// 旋转图片 动作Matrix matrix = new Matrix();matrix.postRotate(angle);System.out.println("angle2=" + angle);// 创建新的图片Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),bm.getHeight(), matrix, true);imageView.setImageBitmap(resizedBitmap);}private static int IMAGE_MAX_WIDTH = 480;private static int IMAGE_MAX_HEIGHT = 960;/** * scale image to fixed height and weight * * @param imagePath * @return */private static int getImageScale(String imagePath) {BitmapFactory.Options option = new BitmapFactory.Options();// set inJustDecodeBounds to true, allowing the caller to query the// bitmap info without having to allocate the// memory for its pixels.option.inJustDecodeBounds = true;BitmapFactory.decodeFile(imagePath, option);int scale = 1;while (option.outWidth / scale >= IMAGE_MAX_WIDTH|| option.outHeight / scale >= IMAGE_MAX_HEIGHT) {scale *= 2;}return scale;}
1 0
- 三星note3 拍照图片转向问题。解决oom
- 解决三星note3调用系统拍照后程序崩溃或无法获取图片
- Cordova PluginPicture关于红米及三星Note3拍照问题...
- 解决三星手机拍照后裁剪图片时横屏问题
- android解决三星手机拍照获取图片的问题
- 三星手机拍照,图片旋转问题的解决
- Android 万恶的三星note3拍照和图片裁剪适配
- 解决三星note3调用系统拍照结束后,重新执行oncreate 方法
- 解决三星手机拍照后,图片旋转。
- 真正解决三星等手机拍照问题
- 解决三星调用系统相机拍照显示图片旋转90度横着的问题
- Android解决三星手机拍照图片调用时逆时针旋转90度问题
- 三星等手机拍照选取图片,图片反转的问题
- 三星拍照旋转问题
- android 手机拍照后获取图片导致OOM问题
- 解决三星android拍照时返回null问题
- android三星等手机拍照自动旋转问题与解决
- 解决三星手机拍照旋转导致崩溃的问题
- linux c++进程通信之消息队列
- Eclipse(或MyEclipse)使用SVN && Authorization failed
- stringstream Error C2514
- 广州治面神经炎
- oracle通过行范围查询
- 三星note3 拍照图片转向问题。解决oom
- 路由跟踪在线Tracert工具说明
- 新同事 spring mvc 培训教程及例子
- 郑州哪家治疗抑郁症好
- MFC如何使用开源Scintilla库?自动源码质量控制软件 iCode 编写全记录(二)
- 在GridView中增加 空行
- GIT fix: stderr: error: bad signature fatal: index file corrupt
- 网络常用命令(九)tc
- 系统调用的原理和实现+添加一个新的系统调用