Working with Images
by, 03-07-2012 at 05:57 PM (1039 Views)
Common tasks present while working with images are:
- To Load an external PNG, GIF & JPEG image format file, to Java 2D™'s internal image representation.
- Creating Java 2D image directly & also rendering to it.
- Java 2D image contents drawn on a drawing surface.
- Java 2D image contents saved to an external PNG, GIF or JPEG image file.
Two classes shall be learnt so that to work with images:
- Java.awt.Image class being a superclass present the graphical images as the rectangle pixel arrays.
- Java.awt.image.BufferedImage class that makes the image class extended so that to permit the application to be operated directly, with image data.
BufferedImage can be rendered by the Graphics2D and Graphics methods as it is the subclass of an Image.
It is basically an image present with accessible data buffer. Therefore work could be done more efficiently with BufferedImage.