Image is an abstract column, and bufferedimage is the implementation of image.
Image and bufferedimage are mainly used to load a pair of images into the memory.
Java loads an image to the memory by using the following methods:
Java code
- String imgpath = "C: // demo.jpg ";
- Bufferedimage image = ImageIO. Read (New fileinputstream (imgpath ));
This method can obtain detailed information about the image, for example, obtaining the image width: image. getwidth (null). The image can be further processed only when it is loaded into memory.
There is also a method for Java code
- String imgpath = "C: // demo.jpg ";
- Image imagetoolkit. getdefatooltoolkit (). getimage (imgpath );
However, this method cannot load the image into the memory, but only obtains the image, so it cannot obtain the image information, and the image length and width cannot be obtained.
Article: http://javapub.iteye.com/blog/683944