BitMap、Drawable、inputStream及byte[] 互转
来源:互联网 发布:视频压缩简易算法 编辑:程序博客网 时间:2024/06/07 11:11
韩梦飞沙 韩亚飞 313134555@qq.com han_meng_fei_sha yue31313
(1) BitMap to inputStream:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
InputStream isBm = new ByteArrayInputStream(baos .toByteArray());
(2)BitMap to byte[]:
Bitmap defaultIcon = BitmapFactory.decodeStream(in);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
defaultIcon.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] bitmapdata = stream.toByteArray();
(3)Drawable to byte[]:
Drawable d; // the drawable (Captain Obvious, to the rescue!!!)
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
defaultIcon.compress(Bitmap.CompressFormat.JPEG, 100, bitmap);
byte[] bitmapdata = stream.toByteArray();
(4)byte[] to Bitmap :
Bitmap bitmap =BitmapFactory.decodeByteArray(byte[], 0,byte[].length);
- BitMap、Drawable、inputStream及byte[] 互转
- BitMap、Drawable、inputStream及byte[] 互转
- BitMap、Drawable、inputStream及byte[] 互转
- BitMap、Drawable、inputStream及byte[] 互转
- BitMap、Drawable、inputStream及byte[] 互转
- BitMap、Drawable、inputStream及byte[] 互转
- android BitMap、Drawable、inputStream及byte[] 互转
- BitMap、Drawable、inputStream及byte[] 互转
- Drawable /Bitmap、String/InputStream、Bitmap/byte[]互转
- Drawable /Bitmap、String/InputStream、Bitmap/byte[]互转
- BitMap、Drawable、InputStream、Byte[]互换
- Android中Bitmap byte[] Drawable InputStream 转化
- Android Bitmap Drawable byte[] InputStream 相互转换
- Drawable、Bitmap、byte[]之间的转换 Bitmap转换成InputStream。
- Android中Bitmap,byte[],Drawable,InputStream相互转化工具类
- Android中Bitmap,byte[],Drawable,InputStream相互转化工具类
- Android中Bitmap,byte[],Drawable,InputStream相互转化工具类
- Android工具类之图片流InputStream->(byte[])->Bitmap/Drawable
- android 根据uri获取真实路径
- 数据结构封装之《DLinkList双向链表》
- android dp和px之间转换
- android 获取标题栏状态栏高度
- android 禁用home键盘
- BitMap、Drawable、inputStream及byte[] 互转
- android root下禁用组件
- android 代码 重启 命令
- jpg等图片批量加页码。
- 以太坊生产网络,测试网络和私有网络的区别
- RobotFramework(一)环境搭建
- android手势解锁-------后台恢复到前台就启动手势解锁
- iOS拍摄视频,自定义拍摄界面,高清压缩,添加水印
- 【HDU