public Bitmap formatBitMapSize(Bitmap bitmapOrg, int twidth, int theight) {// 获取这个图片的宽和高int width = bitmapOrg.getWidth();int height = bitmapOrg.getHeight();// 定义预转换成的图片的宽度和高度int newWidth = twidth;int newHeight = theight;// 计算缩放率,新尺寸除原始尺寸float scaleWidth = ((float) newWidth) / width;float scaleHeight = ((float) newHeight) / height;// 创建操作图片用的matrix对象Matrix matrix = new Matrix();// 缩放图片动作matrix.postScale(scaleWidth, scaleHeight);// 旋转45度// matrix.postRotate(45);// 生成新的bitmapBitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0, width,height, matrix, true);return resizedBitmap;}

……代加

更多相关文章

  1. android调用系统摄像头拍照图片和视频
  2. 【Android通过手势实现的缩放处理】
  3. android数据库中存取图片
  4. 【TabHost】Android设置TabHost文字及图片
  5. 图片url地址转换成file文件
  6. android下载网络图片并缓存
  7. Android 通过Matrix来对图片进行缩放,旋转和平移
  8. android实现图片上传功能(springMvc)

随机推荐

  1. Android魔法(第三弹)—— 一步步实现对折页
  2. 【Android系统源码修改】如何用Android(
  3. Android(安卓)控件之Spinner
  4. android studio gradle 多版本多apk打包(
  5. Android文件相关:RandomAccessFile介绍与
  6. Android(安卓)ClassLoader
  7. Android(安卓)Support V4, V7, V13的作用
  8. [置顶] android ANR
  9. Android(安卓)Studio下Ndk开发踩过的坑以
  10. android 数据存储之 SharedPreference