|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.smartwerkz.jupload.classic.image.ImageUtil
public class ImageUtil
Utility methods for image processing // TODO: make it possible to add/change metadata for testfiles
| Field Summary | |
|---|---|
static int |
POSITION_BOTTOM_LEFT
|
static int |
POSITION_BOTTOM_RIGHT
|
static int |
POSITION_CENTER
|
static int |
POSITION_TOP_LEFT
|
static int |
POSITION_TOP_RIGHT
|
static java.util.List |
readableFormats
|
static java.util.List |
writableFormats
|
| Constructor Summary | |
|---|---|
ImageUtil()
|
|
| Method Summary | |
|---|---|
static void |
cacheBytes(ImageData data,
java.lang.String outputFormat)
|
static void |
cacheFormats()
(Re)Cache all readable and writable formats in the readableFormats
and writableFormats lists. |
static java.awt.image.BufferedImage |
copyImage(java.awt.image.BufferedImage img,
int w,
int h,
java.lang.Object interpolationHint)
Copies the given image where the result will have the given size. |
static java.awt.image.BufferedImage |
copyImage(java.awt.image.BufferedImage img,
int w,
int h,
java.lang.Object interpolationHint,
int type)
Copies the given image where the result will have the given size. |
static java.awt.image.BufferedImage |
copyScaled(java.awt.image.BufferedImage img,
int maxw,
int maxh,
boolean smooth)
Copies the given image with the specified bounds and releases the original's resources. |
static java.awt.image.BufferedImage |
createMergedImage(java.awt.image.BufferedImage img,
java.awt.Image innerImage,
int pos)
|
static ImageData |
getCachedData(java.awt.image.BufferedImage img,
java.lang.String format)
Creates and returns a new ImageData object, containing the given image and its bytes, encoded with the given format. |
static java.util.Iterator |
getImageReadersBySuffix(java.lang.String suffix)
|
static boolean |
isReadableImage(java.io.File file)
|
static boolean |
isReadableImageExtension(java.lang.String ext)
|
static boolean |
isReadableImageName(java.lang.String name)
|
static boolean |
isWritableImageExtension(java.lang.String ext)
|
static boolean |
needsCacheOrConversion(UploadFile file,
int maxw,
int maxh,
boolean inclMetadata,
java.lang.String outputFormat,
java.awt.Dimension dimensionFilter)
Indicates wether caching or conversion is needed. |
static java.awt.image.BufferedImage |
readImage(java.io.File file)
Creates and returns a new BufferedImage from the given file using the file's extension as format. |
static java.awt.image.BufferedImage |
readImage(java.io.InputStream stream,
java.lang.String name)
Creates and returns a new BufferedImage from the given stream using the name's extension as format. |
static java.awt.image.BufferedImage |
readImage(java.net.URL url)
Creates and returns a new BufferedImage from the given URL using the url's extension as format. |
static ImageData |
readImageData(java.io.File file,
boolean inclMetadata,
boolean cacheBytes)
Creates and returns an ImageData object, containing the picture and -if wanted and available- its metadata. |
static java.awt.image.BufferedImage |
resize(java.awt.image.BufferedImage img,
int maxw,
int maxh)
|
static java.awt.image.BufferedImage |
resize(java.awt.image.BufferedImage img,
int maxw,
int maxh,
boolean smooth)
|
static java.awt.image.BufferedImage |
resize(java.awt.image.BufferedImage img,
int maxw,
int maxh,
java.lang.Object interpolationHint)
If necessary or specified, copies the given image with the specified bounds. |
static java.awt.Point |
translatePosition(java.awt.Dimension contSize,
java.awt.Dimension innerSize,
int posType)
Returns the position of the inner object with the given size, according to the posType within the dimensions of w and h. |
static java.awt.Point |
translatePosition(int w,
int h,
int innerW,
int innerH,
int posType)
Returns the position of the inner object with the given size, according to the posType within the dimensions of w and h. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int POSITION_CENTER
public static final int POSITION_TOP_LEFT
public static final int POSITION_TOP_RIGHT
public static final int POSITION_BOTTOM_LEFT
public static final int POSITION_BOTTOM_RIGHT
public static final java.util.List readableFormats
public static final java.util.List writableFormats
| Constructor Detail |
|---|
public ImageUtil()
| Method Detail |
|---|
public static boolean needsCacheOrConversion(UploadFile file,
int maxw,
int maxh,
boolean inclMetadata,
java.lang.String outputFormat,
java.awt.Dimension dimensionFilter)
public static java.awt.image.BufferedImage readImage(java.io.File file)
throws java.io.IOException
java.io.IOException
public static java.awt.image.BufferedImage readImage(java.net.URL url)
throws java.io.IOException
java.io.IOException
public static java.awt.image.BufferedImage readImage(java.io.InputStream stream,
java.lang.String name)
throws java.io.IOException
java.io.IOException
public static ImageData readImageData(java.io.File file,
boolean inclMetadata,
boolean cacheBytes)
throws java.io.IOException
java.io.IOExceptionpublic static java.util.Iterator getImageReadersBySuffix(java.lang.String suffix)
public static ImageData getCachedData(java.awt.image.BufferedImage img,
java.lang.String format)
throws java.io.IOException
java.io.IOException
public static void cacheBytes(ImageData data,
java.lang.String outputFormat)
throws java.io.IOException
java.io.IOException
public static java.awt.image.BufferedImage copyScaled(java.awt.image.BufferedImage img,
int maxw,
int maxh,
boolean smooth)
public static java.awt.image.BufferedImage resize(java.awt.image.BufferedImage img,
int maxw,
int maxh)
public static java.awt.image.BufferedImage resize(java.awt.image.BufferedImage img,
int maxw,
int maxh,
boolean smooth)
public static java.awt.image.BufferedImage resize(java.awt.image.BufferedImage img,
int maxw,
int maxh,
java.lang.Object interpolationHint)
public static java.awt.image.BufferedImage copyImage(java.awt.image.BufferedImage img,
int w,
int h,
java.lang.Object interpolationHint)
public static java.awt.image.BufferedImage copyImage(java.awt.image.BufferedImage img,
int w,
int h,
java.lang.Object interpolationHint,
int type)
public static java.awt.image.BufferedImage createMergedImage(java.awt.image.BufferedImage img,
java.awt.Image innerImage,
int pos)
public static java.awt.Point translatePosition(int w,
int h,
int innerW,
int innerH,
int posType)
public static java.awt.Point translatePosition(java.awt.Dimension contSize,
java.awt.Dimension innerSize,
int posType)
public static void cacheFormats()
readableFormats
and writableFormats lists.
public static boolean isReadableImage(java.io.File file)
public static boolean isReadableImageName(java.lang.String name)
public static boolean isReadableImageExtension(java.lang.String ext)
public static boolean isWritableImageExtension(java.lang.String ext)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||