图片质量压缩 与 图片格式 JPEG PNG
2016-01-23 14:36
337 查看
Bitmap.compress()图片质量压缩方法
提到:<>PNG是一种无损lossess压缩方式,compress方法中quality字段的设置是无效的,JPEG是不透明opaque压缩。
<>像素深度 bitdepth 的概念
/** * Write a compressed version of the bitmap to the specified outputstream. * If this returns true, the bitmap can be reconstructed by passing a * corresponding inputstream to BitmapFactory.decodeStream(). Note: not * all Formats support all bitmap configs directly, so it is possible that * the returned bitmap from BitmapFactory could be in a different bitdepth, * and/or may have lost per-pixel alpha (e.g. JPEG only supports opaque * pixels). * * @param format The format of the compressed image * @param quality Hint to the compressor, 0-100. 0 meaning compress for * small size, 100 meaning compress for max quality. Some * formats, like PNG which is lossless, will ignore the * quality setting * @param stream The outputstream to write the compressed data. * @return true if successfully compressed to the specified stream. */ public boolean Bitmap.compress(CompressFormat format, int quality, OutputStream stream);
图片压缩格式 枚举类型Bitmap.CompressFormat
/*** Specifies the known formats a bitmap can be compressed into
*/
public enum CompressFormat {
JPEG (0),
PNG (1),
WEBP (2);
CompressFormat(int nativeInt) {
this.nativeInt = nativeInt;
}
final int nativeInt;
}
相关文章推荐
- HDOJ 2034 人见人爱A-B
- Android多种方法获取系统时间
- [leetcode] 240. Search a 2D Matrix II 解题报告
- UI_滑竿,分段控制器
- 融合透明者的传说
- 3.11 Templates --Rendering with Helpers
- 4种动态加载JS的方法
- 蓝桥杯 算法提高 分苹果
- iOS个人整理14-界面间传值:属性传值---代理传值---block传值---单例传值
- 多层引用赋值的一个错误
- zabbix server is not running端口未开启10051
- UI_手势
- 服务器下虚拟机ping 本机
- [Mysql for Excel指南] 第三章 配置
- 欢迎使用CSDN-markdown编辑器
- 如何修改自增列值以及相应的解决方法
- React-Native 开发 android & ios App,共享一份代码
- 0003-如何查找01的位置
- UVA213----Message Decoding
- 10026 - Shoemaker's Problem