实例化BufferedImage的步骤

时间:2012-01-12 16:07:14

标签: java instantiation bufferedimage

我一直在研究用于游戏编程目的的BufferedImage类(这样我就可以为关卡制作图像地图并使用getRGB()来识别每个像素中的图块),但是我我很困惑如何实际制作BufferedImage。令我特别困惑的是你如何使用BufferedImage作为参数来Image。一步一步,如何为简单的图像文件(例如.jpg)实例化BufferedImage

2 个答案:

答案 0 :(得分:4)

简单步骤 - ImageIO.read(File file),如documentation

所示

答案 1 :(得分:0)

您可以使用ImageIO.read(new File("example.jpg"));

加载图片