Images are a key component of web design. Images are objects of the Image class, which is part of the java.awt package. There are three common operations that occur when we work with images, they are create an image, loading an image, and display an image. In java, the image class is used to refer an image in memory and to images that must be loaded from external source.


Images must eventually be painted on a window to be seen, the Image class does not have enough information about its environment to create the proper data format for the screen. The Component class java.awt has a factory method called createImage() that is used to create Image object.


For loading an image we use the method getImage().

Eg: Image getImage(URL url);, This returns an Image object that encapsulates the image found at the location specified in the url.

To display an image we use the method drawImage(), which is a member of Graphics class.

boolean drawImage(Image imgObj, int left, int top, ImageObserver imgObs);



ImageObserver is an interface used to receive notification as an image is being generated. It contains only one method that is imageUpdate(). Using an image observer allows to show a progress indicator or an attract screen when we do a download action.



ImageObserver is difficult to manage when we use multiple images. MediaTracker provides solution for this problem. A MediaTracker is an object that will check the status of an arbitrary number of images in parallel.To use MediaTracker we create a new instance and use its addImage() method to track the loading status of an image. A reference in MediaTracker will prevent the system from garbage collecting it. If you want the system to be able to garbage collect images that were being tracked, make sure that it can collect the MediaTracker instance as well.



It is an interface for objects that want to produce data for images. An object that implements the ImageProducer interface will supply integer or byte array that represents image data and produce Image object.



ImageConsumer is an abstract interface for objects that want to take pixel data from images and supply it as another kind of data. This is the opposite of ImageProducer. An object that implements the ImageConsumer interface is going to create int or byte array that represents pixels from an Image object.

The Java Advanced Imaging API extends the Java 2 platform by allowing high-performance image manipulations to be incorporated into Java applets and applications.