Javatpoint Logo
Javatpoint Logo

Java Image

Image class in Java is an abstract superclass for all the other classes used for graphical image representation.

Class Declaration

The declaration for java.awt.Image class is as following:

Java Image Class Fields

Following table shows various fields of Image class.

Field Description
protected float accelerationPriority It prioritise for accelerating the image.
static int SCALE_AREA_AVERAGING It uses the area averaging image scaling algorithm.
static int SCALE_DEFAULT It use the default image-scaling algorithm.
static int SCALE_FAST It chooses an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.
static int SCALE_REPLICATE It uses the image scaling algorithm embodied in the ReplicateScaleFilterClass.
static int SCALE_SMOOTH It chooses an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.
static Object UnderfinedProperty The UndefinedProperty object should be returned whenever a property that was not defined for a particular image is fetched.

Image Class Methods

Method Description
void flush() It flushes all reconstructable resources being used by this image object.
float getAccelerationPriority() It returns the current value of the acceleration priority hint.
ImageCapabilities getCapabilities(GraphicsConfiguration gc) It returns an ImageCapabilities object which can be inquired as to the capabilities of this image on the specified GraphicsConfiguration.
abstract Graphics getGraphics() It creates a graphics context for drawing to an offscreen image.
abstract int getHeight(ImageObserver observer) It determines the height of the image.
abstract Object getProperty(String name, ImageObserver observer) It gets a property of the image by name.
Image getScaledInstance(int width, int height, int hints) It creates a scaled version of the image.
abstract ImageProducer getSource() It gets the object that produces the pixels for the image.
abstract int getWidth(ImageObserver observer) It determines the width of the image.
void setAccelerationPriority(float priority) It sets a hint for the image about how important acceleration is.

Java Image Example

The following program demonstrates the use of Image class in Java.


Java Image

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA