Java supports images through the Image class, which is defined in the java.awt package.
The Image class encapsulates the rectangular pixel data of an image and provides methods for drawing and accessing image information.
For example, the getWidth() and getHeight() methods obtain the width and height of an image, respectively.
Image types
There are many different formats for representing an image's pixel data. Java supports two major image formats, JPEG and GIF, each of which are geared toward representing a certain type of image.
JPEG (Joint Photographic Experts Group): provides a highly efficient means of storing photographic images; image files typically have a .jpg file extension
GIF (Graphics Interchange Format): useful for storing images other than photographs such as illustrations and diagrams; imagefiles typically have a .gif file extension