字节数组到图像的转换 [英] conversion of byte array to image

查看:69
本文介绍了字节数组到图像的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将字节数组转换为图像,为此我使用了代码

I want to convert a byte array to an image ,For that I used the code

final BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(decrpt));

其中Decrypt是字节数组,它在ImageIO中显示错误.我不知道参数pls是什么帮助我进行排序.

where Decrypt is the byte array,It showing error in ImageIO.I dont know what is that parameter pls help me to sort it out.

推荐答案

希望此代码对您有帮助:

Hope this code will help you:

byte[] data = item1.getBytes();
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
imageview.setImageBitmap(bmp);

这篇关于字节数组到图像的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆