第一种:从文件读取
File imageFile = new File("image.jpeg"); //image.jpeg图片要与类文件在同一目录下
Image image = ImageIO.read(imageFile);
第二种:从输入流读取
InputStream is = new BufferedInputStream(new FileInputStream("pic.jpg")); //pic.jpg图片要与类文件在同一目录下
image = ImageIO.read(is);
第三种:从网络读取
URL url = new URL(http://www.XXX.jpg);
image = ImageIO.read(url);