得到ImageView的图片,压缩成PNG,并得到二进制流数据
来源:互联网 发布:未来软件官网 编辑:程序博客网 时间:2024/05/17 08:00
byte[] img_data;
//设置图片
ImageView imgExtendImageView1 = new ImageView(mContext);
imgExtendImageView1.setImageResource(R.drawable.test);
//设置尺寸
imgExtendImageView1.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
imgExtendImageView1.layout(0, 0, imgExtendImageView1.getMeasuredWidth(), imgExtendImageView1.getMeasuredHeight());
//得到 Bitmap
imgExtendImageView1.setDrawingCacheEnabled(true);
imgExtendImageView1.buildDrawingCache(true);
Bitmap obmp = imgExtendImageView1.getDrawingCache();
//压缩成PNG
final ByteArrayOutputStream os = new ByteArrayOutputStream();
obmp.compress(Bitmap.CompressFormat.PNG, 100, os);
//得到二进制数据
img_data = os.toByteArray();
imgExtendImageView1.setDrawingCacheEnabled(false);
- 得到ImageView的图片,压缩成PNG,并得到二进制流数据
- 得到ImageView的图片,压缩成PNG,并得到二进制流数据
- 得到ImageView的图片,压缩成PNG,并得到二进制流数据
- ImageView的图片,压缩成PNG,并得到二进制流数据
- java servlet 得到上传过来的图片二进制流
- Android拍照得到全尺寸图片并进行压缩
- Android拍照得到全尺寸图片并进行压缩
- Android中 得到ImageView中显示的图片
- 安卓中获取imageview的图,在另一个imageview里显示,还有得到图片
- ios图片旋转,并得到旋转后的图片
- 得到图片的缩略图
- ImageView.ScaleType设置图片(变相的也是得到一种剪裁后的图片)
- ImageView的Matrix可以得到的神马
- 使用canvas合成图片并得到的启发
- 得到服务器的数据
- 创建位图并得到位数据区的指针
- python3爬虫得到的数据乱码并进行处理
- iOS开发 ImageView网络请求得到的图片不变形处理
- iptables防火墙
- 2015年的新计划
- [转通项公式][zoj - 3857] Hypersphere
- :姥爷你请客吃饭吧。我没钱,还不能挣钱。 姥爷:我也没钱 :那让我姥姥把钱借给你
- springMVC+Hibernate简单的Demo
- 得到ImageView的图片,压缩成PNG,并得到二进制流数据
- CCS使用常见问题
- Android手机开发学习《二》
- 1045 access denied for user 'root'@'localhost' using password yes 解决办法
- 调用DLL窗体 cannot assign a TFont to a TFont 问题
- FastMM4
- XE笔记
- openstack中swift和cinder中的区别
- ubuntu下eclipse不识别手机解决方案