|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.sdsc.mbt.image.ImageUtils
Provides AWT-based (pure Java) image manipulation methods for cropping, scaling, and padding images.
Constructor Summary | |
ImageUtils()
|
Method Summary | |
static java.awt.image.BufferedImage |
autoCropAndScale(java.awt.Image image,
int outWidth,
int outHeight)
Find the edges of the input image using the upper left corner pixel color as the background color, automatically crop the image down to eliminate the excess background border, then scale the image (maintaining the correct aspect ratio of the input image) and then center the image with appropriate background padding of the specified output width and height. |
static int[] |
findEdges(int[] pixels,
int width,
int height)
Find the edges of the image by finding the min/max x,y coordinate where pixels are a different color than the upper left pixel. |
static int |
getPixel(int[] pixels,
int width,
int x,
int y)
Return one pixel (as 4-byte, 24-bit, 8-bit-per-component, ARGB int) given the raw pixel array returned by the getPixels method. |
static int[] |
getPixels(java.awt.Image image)
Return the pixels (as 4-byte, 24-bit, 8-bit-per-component, ARGB ints). |
static void |
main(java.lang.String[] args)
Unit testing entry point. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ImageUtils()
Method Detail |
public static java.awt.image.BufferedImage autoCropAndScale(java.awt.Image image, int outWidth, int outHeight)
public static int[] getPixels(java.awt.Image image)
public static int getPixel(int[] pixels, int width, int x, int y)
public static int[] findEdges(int[] pixels, int width, int height)
public static void main(java.lang.String[] args)
argv[0] = input image file name.
argv[1] = output JPEG image file name.
argv[2] = output image width.
argv[3] = output image height.
Example: java ImageUtils inFile.png outFile.jpg 512 512
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |