The BufferedImage Java class.
An object that defines a number of image-related utility functions.
A format constant indicating the BMP (bmp) image format.
A format constant indicating the GIF89a (gif) image format.
A format constant indicating the JPEG (jpg) image format.
A format constant indicating the JPEG2000 (jp2) image format.
A format constant indicating the PNG (png) image format.
Indicates that images should be stitched from left to right.
Indicates that images should be stitched from top to bottom.
Returns a new copy of the specified image. If you are going to draw on an image that you obtained from resources, it is important to work with a copy so that you don't alter the shared version stored in the image cache.
the image to copy
a new copy of the source image
Returns a new image with the specified dimensions. If transparent
is true,
the image will have an alpha channel and pixels can be transparent or
translucent. Otherwise, all pixels in the image are opaque.
the image width, in pixels; must be greater than zero
the image height, in pixels; must be greater than zero
if true, the image includes an alpha channel (default is false)
an image with the requested parameters
Returns a new image with pixel dimensions calculated from a measurement in
points and a specified resolution in pixels per inch. One point is defined
to be 1/72 of an inch. Thus, at a resolution of 300 ppi, a width of 36 points
would translate to a pixel width of 150 pixels. If transparent
is true,
the image will have an alpha channel and pixels can be transparent or
translucent. Otherwise, all pixels in the image are opaque. The calculated
image size must be at least one pixel wide and high.
the image resolution, in pixels per inch
the image width, in points
the image height, in points
if true, the image includes an alpha channel (default is false)
an image with the requested parameters
Returns a new icon that displays an existing image.
The icon will be resized to fit within size
×size
pixels.
the image used to create the icon, which is not changed
the target size for the icon (default is 16)
an icon that displays the image at the requested size
Creates an image by cropping a source image. The resulting image
will consist of the subimage of the source image that starts at pixel
(x
, y
) in the source image and is width
by height
pixels in size.
Either width
or height
(or both) may undefined or less than 1, in which case the crop
will extend to the right (or bottom) edge of the image, respectively.
the source image, which is not changed
the x-coordinate of the upper-left corner of the region to retain in the destination
the y-coordinate of the upper-left corner of the region to retain in the destination
the width of the region to retain in the destination, or -1 to use the image edge
the height of the region to retain in the destination, or -1 to use the image edge
a new image containing the cropped region of the source image
Returns a copy of the image converted to greyscale.
the source image, which is not changed
the desaturated image
Ensures that an image is as large as it can be and still fit within the given dimensions without changing the aspect ratio. If the image already just fits it is returned unchanged. Otherwise a new, resized image is returned.
the image to fit within the space, which is not changed
the maximum width of the image
the maximum height of the image
an optional hint used when the image needs to be resized; if true, lower quality but faster resampling is performed (default is false, use higher quality)
the original image, or a resized copy sized to just fit within the specified dimensions
Returns an image loaded from an image file stored in the plug-in resources
folder.
If the image cannot be loaded (for example, if no image file exists at the given resource path), returns null
.
a path string relative to the resources
folder
if true, the image may be cached to speed future requests for the same resource (default is true)
if true, no error is displayed if loading the image fails (default is false, display an error message)
the image, or null
Returns an icon loaded from an image file stored in the plug-in resources
folder.
If the image cannot be loaded (for example, if no image file exists at the given resource path), returns null
.
a path string relative to the resources
folder
if true, then the current theme will not be allowed to modify the icon image to fit the theme (default is false, icon can be themed)
the icon, or null
Returns a copy of the image with all of the pixels inverted. The result is similar to a photographic negative.
the source image, which is not changed
the inverted image
Returns a new image that mirrors and/or flips the the source image.
the source image, which is not changed
if true, mirrors the image horizontally (default is true)
if true, mirrors the image vertically (default is false)
the rotated image
Returns a padded copy of the image that adds margins of the given sizes to the outside of the image. A margin may be negative, in which case rows or columns will be removed from that edge.
the source image, which is not changed
the number of pixels to add to the top edge
the number of pixels to add to the left edge
the number of pixels to add to the bottom edge
the number of pixels to add to the right edge
a padded copy of the image
Returns a padded copy of the image that adds a margin on each side of the image. The margin may be negative, in which case rows or columns will be removed.
the source image, which is not changed
a padded copy of the image
Returns an image decoded from an image file stored on the user's device.
the file to read from
the decoded image
Creates a copy of an image that is resampled to a new size.
the image to create a resized copy of
the width of the new image, in pixels (must be positive)
the height of the new image, in pixels (must be positive)
an optional hint; if true, lower quality but faster resampling is performed (default is false, use higher quality)
the resized copy of the source image
Prompts the user to choose a file, then saves the specified image to the selected file. A default file may be suggested as the starting point for file selecton; if none is selected then a default location is selected based on the last-saved file.
the image to save, which is not changed
an optional default file to suggest to the user
an optional component to act as the parent of the dialog
the file that the user selected, or null if the save was cancelled
Returns a new image that combines two source images by "stitching" them
together along an edge. If stitchEdge
is ImageUtils.STITCH_HORIZONTAL
,
then the left edge of image2
will be stitched to the right edge of image1
.
If stitchEdge
is ImageUtils.STITCH_VERTICAL
, then the top edge of
image2
will be stitched to the bottom edge of image1
. If either source
image has transparency, then the returned image will also; otherwise it is opaque.
the first image to be stitched, which is not changed
the second image to be stitched, which is not changed
the edge to joint the images along, STITCH_HORIZONTAL
or STITCH_VERTICAL
a new image combining the source images at their edges
Returns a tinted copy of an image. The value of h
is a relative
number of degrees. The hue of each pixel in the source image will be
shifted by h
× 360 degrees around the HSB colour wheel: a value of
0 (or 1) leaves the hue unchanged, while a value of 0.5 shifts the hue
by 180 degrees to its complementary colour. The value of s
is a saturation factor;
each pixel's saturation will be multiplied by this value. A value of 0 will
convert the image to greyscale. A value of 1 will leave the saturation
unchanged. The value of b
is a brightness factor. Each pixel's
brightness will be multiplied by this value. A value of 0 will set each
pixel's brightness to 0, resulting in a black image. A value of 1 will leave
the brightness unchanged.
the source image, which is not changed
the hue shift to apply expressed as a number of rotations around the colour wheel
the saturation factor to apply
the brightness factor to apply
a tinted copy of the image
Returns a tinted copy of an image. The elements of the hsb
array specify
h
, a hue shift (in rotations), s
, a saturation adjustment factor, and b
, a brightness
adjustment factor, respectively.
The hue of each pixel in the source image will be
shifted by h
× 360 degrees around the HSB colour wheel: a value of
0 (or 1) leaves the hue unchanged, while a value of 0.5 shifts the hue
by 180 degrees to its complementary colour. The saturation level of each pixel
will be multiplied by s
. A value of 0 will convert the image to greyscale.
A value of 1 will leave the saturation The brightness of each pixel will be multiplied
by b
. A value of 0 will set each pixel's brightness to 0, resulting in a black image.
A value of 1 will leave the brightness unchanged.
the source image, which is not changed
a tinted copy of the image
Returns a trimmed copy of the source image that excludes fully transparent (alpha=0) rows and columns around the image's edges. If there are no such rows or columns, returns the original image. If the entire image is fully transparent, returns a 1x1 transparent image.
the source image, which is not changed
a trimmed copy of the image
Displays an image in an image viewer window.
the image to view, which is not changed
an optional title for the viewer
if true, the viewer blocks the application until closed (default is false)
an optional parent window (default is the application window)
Writes an image to a file.
the image to write, which is not changed
the file to write to
the image format (default is "png"
)
a value between 0 and 1 inclusive that describes the desired tradeoff between smaller size and better image quality (use -1 for default quality; 1 for maximum quality)
if true and supported by the format, requests that the file be organized so that it can be displayed progressively as it downloads (default is false)
if defined and supported by the encoder, the image's metadata will indicate that this value is the the resolution of the image in pixels per inch
imageutils library
Defines the
ImageUtils
object, which helps you work with images. Include this library by addinguseLibrary("imageutils")
to your script.Example of use:
useLibrary( "imageutils" ); let src = ImageUtils.get("icons/application/256.png"); let tinted = ImageUtils.tint(src, 0.25, 1.8, 1.4); ImageUtils.view(tinted);