scale image的方法
来源:互联网 发布:js escapehtml 编辑:程序博客网 时间:2024/05/18 02:40
public static Bitmap scaleImg(Bitmap bm, int newWidth, int newHeight) {
// 获得图片的宽高
int width = bm.getWidth();
int height = bm.getHeight();
// 设置想要的大小
int newWidth1 = newWidth;
int newHeight1 = newHeight;
// 计算缩放比例
float scaleWidth = ((float) newWidth1) / width;
float scaleHeight = ((float) newHeight1) / height;
// 取得想要缩放的matrix参数
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
// 得到新的图片
Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix,
true);
if (width != newWidth && height != newHeight) {
freeBitmap(bm);
}
return newbm;
}
// 获得图片的宽高
int width = bm.getWidth();
int height = bm.getHeight();
// 设置想要的大小
int newWidth1 = newWidth;
int newHeight1 = newHeight;
// 计算缩放比例
float scaleWidth = ((float) newWidth1) / width;
float scaleHeight = ((float) newHeight1) / height;
// 取得想要缩放的matrix参数
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
// 得到新的图片
Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix,
true);
if (width != newWidth && height != newHeight) {
freeBitmap(bm);
}
return newbm;
}
- scale image的方法
- Image scale type
- 复合文件的一个小Demo,Image+scale
- image scale和size的关系与SDScaledImageForKey
- 灰度图Gray Scale Image 或是 Gray Scale Image
- 灰度图Gray Scale Image 或是 Gray Scale Image
- Saliency, Scale and Image Description
- canvas的translate、scale、rotate等方法
- canvas的translate、scale、rotate等方法
- canvas的translate、scale、rotate等方法
- Image 的 getRGB方法
- [Paper Reading] Attention to Scale: Scale-aware Semantic Image Segmentation
- 语义分割--Attention to Scale: Scale-aware Semantic Image Segmentation
- 16. 26. 3. 装入想要尺寸的图片 Load Image and scale it
- 设置光栅图(raster image)的比例(scale)及手动设置高宽。
- UT-Austin大学在Image search and large-scale retrieval方面的一系列papers
- 大规模图像分类器的演化-Large-Scale Evolution of Image Classifiers-读后杂谈
- ios 将UIView保存Image,依据scale
- 利用U盘安装win7
- 十七周:作文题(很棒的题目啊)
- javascript text 只能输入数字 小数点
- 如何只导出 ms sql server 2005 的表结构
- 当你没事干的时候。。。
- scale image的方法
- spring2.5
- html css中id和class的区别
- anroid中的消息处理机制--基本概念
- build a local server
- makefile 教程 非常详细,且易懂
- ceel num Exceed Limit
- CRC原理
- 2012 年 6 月开发语言排行榜 - Haskell 快速逼近 top20