com.gif4j.light
Class ImageUtils

java.lang.Object
  extended bycom.gif4j.light.ImageUtils

public class ImageUtils
extends java.lang.Object

This class containts some useful image processing methods.

Version:
1.0
Author:
Gif4J Software - Java GIF image processing solutions

Constructor Summary
ImageUtils()
           
 
Method Summary
static void loadImage(java.awt.Image image)
          This method ensures that all pixels of the specified Image have been loaded and load them in other case
static java.awt.Image scale(java.awt.Image source, int newWidth, int newHeight, boolean keepRatio)
          Convenient static method to resize down (minimize) instance of Image to the specified size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtils

public ImageUtils()
Method Detail

loadImage

public static final void loadImage(java.awt.Image image)
                            throws java.lang.InterruptedException
This method ensures that all pixels of the specified Image have been loaded and load them in other case

Parameters:
image - Image to load
Throws:
java.lang.InterruptedException - If there is an error while loading

scale

public static final java.awt.Image scale(java.awt.Image source,
                                         int newWidth,
                                         int newHeight,
                                         boolean keepRatio)
Convenient static method to resize down (minimize) instance of Image to the specified size. If source image size less then the specified then the method returns the source image without processing. If 'keepRatio' parameter is true then the specified image will resize proportionally and new size can be not exactly equal to the specified newWidth/newHeight.

Parameters:
source - image to resize down (minimize)
newWidth - width which source image should be minimized to (the result image can have less width if 'keepRatio' parameter set to true)
newHeight - height which source image should be minimized to (the result image can have less height if 'keepRatio' parameter set to true)
keepRatio - resize image proportionally
Returns:
new minimized instance of Image or source image if its' width and height less than the specified newWidth and newHeight
Throws:
java.lang.NullPointerException - If source image is null
See Also:
Image