使用Inputstream打开位图 [英] Open a bitmap with Inputstream

查看:96
本文介绍了使用Inputstream打开位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Inputstream打开位图?

How would I open a bitmap with Inputstream?

例如 InputStream inputStream = image 其中image是类型位图

e.g InputStream inputStream = image where image is of type Bitmap?

谢谢。

推荐答案

要读取应用中的位图图像,

BufferedImage img = ImageIO.load(mybitmap.bmp);

To read the bitmap image in your app,
BufferedImage img = ImageIO.load("mybitmap.bmp");

要从缓冲的图像对象中获取像素,请使用 getRGB()

To get the pixels from the buffered image object, use getRGB()

int[] pixels = img.getRGB(0, 0, img.getWidth(), img.getHeight(), null, 0, img.getWidth());

getRGB()

有关详细信息,请参阅文章。

For more info, see this article.

这篇关于使用Inputstream打开位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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