public class ImageUtil
extends java.lang.Object
Constructor and Description |
---|
ImageUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getJSONMetadata(java.io.File file)
return the node containing JSON metadata showing where the plots are in images
produced by the Autoplot Das2 library, or null.
|
static java.awt.image.BufferedImage |
getScaledInstance(java.awt.image.BufferedImage img,
int thumbSize)
convenient typical use.
|
static java.awt.image.BufferedImage |
getScaledInstance(java.awt.image.BufferedImage img,
int width,
int height,
boolean pad)
convenient typical use, returns the biggest scaled instance which would fit in a box.
|
static java.awt.image.BufferedImage |
getScaledInstance(java.awt.image.BufferedImage img,
int targetWidth,
int targetHeight,
java.lang.Object hint,
boolean higherQuality)
Convenience method that returns a scaled instance of the
provided
BufferedImage . |
static java.lang.String |
getScriptURI(java.io.File file)
return the value of the text node apscript, if it is found, so the image
could be recreated.
|
public static java.lang.String getJSONMetadata(java.io.File file) throws java.io.IOException
file
- the png file.java.io.IOException
public static java.lang.String getScriptURI(java.io.File file) throws java.io.IOException
file
- png file, produced by Autoplot using the Run Batch Tool.java.io.IOException
public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img, int thumbSize)
img
- image to resize.thumbSize
- corner-to-corner size, preserving aspect ratio.public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img, int width, int height, boolean pad)
img
- image to resize.width
- the widthheight
- the heightpad
- pad the image so that width and height are used.public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img, int targetWidth, int targetHeight, java.lang.Object hint, boolean higherQuality)
BufferedImage
.
first from http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html
resize taken from http://www.componenthouse.com/article-20img
- the original image to be scaledtargetWidth
- the desired width of the scaled instance,
in pixelstargetHeight
- the desired height of the scaled instance,
in pixelshint
- one of the rendering hints that corresponds to
RenderingHints.KEY_INTERPOLATION
(e.g.
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
,
RenderingHints.VALUE_INTERPOLATION_BILINEAR
,
RenderingHints.VALUE_INTERPOLATION_BICUBIC
)higherQuality
- if true, this method will use a multi-step
scaling technique that provides higher quality than the usual
one-step technique (only useful in downscaling cases, where
targetWidth
or targetHeight
is
smaller than the original dimensions, and generally only when
the BILINEAR
hint is specified)BufferedImage