Android(安卓)-- 重置Bitmap大小&&Bitmap转角度
16lz
2021-01-25
重置Bitmap大小
Bitmap bitMap = BitmapFactory.decodeFile(path);int width = bitMap.getWidth();int height = bitMap.getHeight();// 设置想要的大小int newWidth = 500;int newHeight = 400;// 计算缩放比例float scaleWidth = ((float) newWidth) / width;float scaleHeight = ((float) newHeight) / height;// 取得想要缩放的matrix参数Matrix matrix = new Matrix();matrix.postScale(scaleWidth, scaleHeight);// 得到新的图片 bitMap = Bitmap.createBitmap(bitMap, 0, 0, width, height, matrix, true);
Bitmap转角度
Bitmap bm = BitmapFactory.decodeByteArray(imgdata, 0,imgdata.length);Matrix matrix = new Matrix();matrix.preRotate(270);bm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),bm.getHeight(), matrix, true);
imgdata为camera开发的时候的图片数据。
这里其实找到了bitmap就OK了。
转载请注明出处:http://www.cnblogs.com/yydcdut/p/3744875.html
更多相关文章
- Android控件之ImageButton
- Java 软引用及在Android中的应用
- 图片加载框架简单介绍 ImageLoader 的基本使用
- Android(安卓)Intent 总结
- android ImageButton显示本地图片
- android 游戏开发过程中让图片自适应
- android 仿qq分组
- Android(安卓)首页轮播图实现
- android 高效显示Bitmap - 开发文档翻译