bitmap压缩到指定尺寸-在手机上把图片压缩到1m以下,怎么办
Bitmap改变大小

用StretchBlt可以放大或缩小bitmap
The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.
BOOL StretchBlt(
HDC hdcDest, // handle to destination DC
int nXOriginDest, // x-coord of destination upper-left corner
int nYOriginDest, // y-coord of destination upper-left corner
int nWidthDest, // width of destination rectangle
int nHeightDest, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXOriginSrc, // x-coord of source upper-left corner
int nYOriginSrc, // y-coord of source upper-left corner
int nWidthSrc, // width of source rectangle
int nHeightSrc, // height of source rectangle
DWORD dwRop // raster operation code
);
Android中压缩图片指定大小

注意看这句话,(, 100, baos);
那里的数字表示 如果不压缩是100,表示压缩率为0。
如果是70,就表示压缩率是70,表示压缩30%;
所以你的倒数第二句话表示没有压缩。
以下是我压缩的方法,望采纳。
/**
* 图像压缩并保存到本地
* 返回处理过的图片
*
*/
private Bitmap
saveImage(String fileName,Bitmap bit) {
File file = new
File(fileName);
if (!()) {
try
{
();
} catch (IOException e)
{
e.printStackTrace();
}
}
try
{
ByteArrayOutputStream stream = new
ByteArrayOutputStream();
(, 70,
stream);
// 70 是压缩率,表示压缩30%; 如果不压缩是100,表示压缩率为0
FileOutputStream os =
new
FileOutputStream(file);
(());
();
return
bit;
} catch (Exception e) {
file = null;
return
null;
}
}
在手机上把图片压缩到1m以下,怎么办

在手机上用
美图秀秀
打开图片,然后另存,把品质降低即可。
图片是指由图形、图像等构成的平面媒体。图片的格式很多,但总体上可以分为点阵图和
矢量图
两大类,我们常用BMP、JPG等格式都是点阵图形,而SWF、CDR、AI等格式的图形属于矢量图形。
名词解释:
位图(外语简称:BMP、外语全称:Bitmap),它是Windows操作系统中的标准图像文件格式,能够被多种Windows
应用程序
所支持。
随着Windows操作系统的流行与丰富的Windows应用程序的开发,BMP位图格式理所当然地被广泛应用。这种格式的特点是包含的图像信息较丰富,几乎不进行压缩,但由此导致了它与生俱来的缺点――占用磁盘空间过大,所以,BMP在单机上比较流行。
-
果盘绘画图片大全简单创作方法快速制作技巧2024-01-02 16:57:54
-
小年插画图片创作方法快速制作技巧2024-01-02 16:57:20
-
小年绘画作品制作技巧2024-01-02 16:55:45
-
小年插画图片创作方法快速制作技巧2024-01-02 16:55:02
-
立春插画图片如何制作2024-01-02 16:54:19
-
立春插画图片创作方法快速制作技巧2024-01-02 16:53:32






扫描二维码添加客服微信
扫描二维码关注