org.das2.util.ImageUtil

Utilities for image files and images.

ImageUtil( )


getJSONMetadata

getJSONMetadata( java.io.File file ) → String

return the node containing JSON metadata showing where the plots are in images produced by the Autoplot Das2 library, or null.

Parameters

file - the png file.

Returns:

null or the JSON describing the image. See http://autoplot.org/developer.richPng

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getScaledInstance

getScaledInstance( java.awt.image.BufferedImage img, int thumbSize ) → java.awt.image.BufferedImage

convenient typical use.

Parameters

img - image to resize.
thumbSize - corner-to-corner size, preserving aspect ratio.

Returns:

buffered image that is thumbSize across.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getScaledInstance

getScaledInstance( java.awt.image.BufferedImage img, int width, int height, boolean pad ) → java.awt.image.BufferedImage

convenient typical use, returns the biggest scaled instance which would fit in a box. The returned image will have the same aspect ratio.

Parameters

img - image to resize.
width - the width
height - the height
pad - pad the image so that width and height are used.

Returns:

buffered image that is thumbSize across.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getScaledInstance

getScaledInstance( java.awt.image.BufferedImage img, int targetWidth, int targetHeight, Object hint, boolean higherQuality ) → java.awt.image.BufferedImage

Convenience method that returns a scaled instance of the provided 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-20

Parameters

img - the original image to be scaled
targetWidth - the desired width of the scaled instance, in pixels
targetHeight - the desired height of the scaled instance, in pixels
hint - one of the rendering hints that corresponds to {@code RenderingHints.KEY_INTERPOLATION} (e.g. {@code RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR}, {@code RenderingHints.VALUE_INTERPOLATION_BILINEAR}, {@code 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 {@code targetWidth} or {@code targetHeight} is smaller than the original dimensions, and generally only when the {@code BILINEAR} hint is specified)

Returns:

a scaled version of the original {@code BufferedImage}

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getScriptURI

getScriptURI( java.io.File file ) → String

return the value of the text node apscript, if it is found, so the image could be recreated.

Parameters

file - png file, produced by Autoplot using the Run Batch Tool.

Returns:

null or the script.

[search for examples] [view on GitHub] [view on old javadoc] [view source]