public class IcyBufferedImageUtil extends java.lang.Object
IcyBufferedImage
utilities class.Modifier and Type | Class and Description |
---|---|
static class |
IcyBufferedImageUtil.FilterType |
Constructor and Description |
---|
IcyBufferedImageUtil() |
Modifier and Type | Method and Description |
---|---|
static IcyBufferedImage |
addChannel(IcyBufferedImage source)
Add an empty channel to the specified image and return result as a new image.
|
static IcyBufferedImage |
addChannel(IcyBufferedImage source,
int index)
Add an empty channel to the specified image and return result as a new image.
|
static IcyBufferedImage |
addChannels(IcyBufferedImage source,
int index,
int num)
Add empty channel(s) to the specified image and return result as a new image.
|
static IcyBufferedImage |
convertToType(IcyBufferedImage source,
DataType dataType,
boolean rescale)
Convert the source image to the specified data type.
|
static IcyBufferedImage |
convertToType(IcyBufferedImage source,
DataType dataType,
boolean rescale,
boolean useDataBounds)
Convert the source image to the specified data type.
|
static IcyBufferedImage |
convertToType(IcyBufferedImage source,
DataType dataType,
Scaler scaler)
Convert the source image to the specified data type.
|
static IcyBufferedImage |
extractChannel(IcyBufferedImage source,
int channel)
Build a new single channel image (greyscale) from the specified source image channel.
|
static IcyBufferedImage |
extractChannels(IcyBufferedImage source,
int... channels)
Build a new image from the specified source image channels.
|
static IcyBufferedImage |
extractChannels(IcyBufferedImage source,
java.util.List<java.lang.Integer> channelNumbers)
Deprecated.
Use
extractChannels(IcyBufferedImage, List) instead. |
static java.awt.image.BufferedImage |
getARGBImage(IcyBufferedImage source)
Convert the current
IcyBufferedImage into a ARGB BufferedImage . |
static java.awt.image.BufferedImage |
getARGBImage(IcyBufferedImage source,
java.awt.image.BufferedImage dest)
Draw the source
IcyBufferedImage into the destination ARGB BufferedImage If dest is null then a new ARGB BufferedImage is returned. |
static java.awt.image.BufferedImage |
getARGBImage(IcyBufferedImage source,
LUT lut)
Convert the current
IcyBufferedImage into a ARGB BufferedImage . |
static java.awt.image.BufferedImage |
getARGBImage(IcyBufferedImage source,
LUT lut,
java.awt.image.BufferedImage dest)
Draw the source
IcyBufferedImage into the destination ARGB BufferedImage If dest is null then a new ARGB BufferedImage is returned. |
static IcyBufferedImage |
getCopy(IcyBufferedImage source)
Create a copy of the specified image.
|
static IcyBufferedImage |
getSubImage(IcyBufferedImage source,
int x,
int y,
int w,
int h)
Creates a new image which is a sub part of the source image from the specified
coordinates and dimensions.
|
static IcyBufferedImage |
getSubImage(IcyBufferedImage source,
int x,
int y,
int c,
int sizeX,
int sizeY,
int sizeC)
Deprecated.
Use
getSubImage(IcyBufferedImage, Rectangle, int, int) instead. |
static IcyBufferedImage |
getSubImage(IcyBufferedImage source,
java.awt.Rectangle region)
Creates a new image which is a sub part of the source image from the specified region.
|
static IcyBufferedImage |
getSubImage(IcyBufferedImage source,
java.awt.Rectangle region,
int c,
int sizeC)
Creates a new image from the specified region of the source image.
|
static IcyBufferedImage |
rotate(IcyBufferedImage source,
double angle)
Return a rotated version of the source image with specified parameters.
|
static IcyBufferedImage |
rotate(IcyBufferedImage source,
double xOrigin,
double yOrigin,
double angle,
IcyBufferedImageUtil.FilterType filterType)
Return a rotated version of the source image with specified parameters.
|
static IcyBufferedImage |
rotate(IcyBufferedImage source,
double angle,
IcyBufferedImageUtil.FilterType filterType)
Return a rotated version of the source image with specified parameters.
|
static IcyBufferedImage |
scale(IcyBufferedImage source,
int width,
int height)
Return a copy of the image with specified size.
|
static IcyBufferedImage |
scale(IcyBufferedImage source,
int width,
int height,
boolean resizeContent,
int xAlign,
int yAlign)
Return a copy of the image with specified size.
|
static IcyBufferedImage |
scale(IcyBufferedImage source,
int width,
int height,
boolean resizeContent,
int xAlign,
int yAlign,
IcyBufferedImageUtil.FilterType filterType)
Return a copy of the source image with specified size, alignment rules and filter type.
|
static IcyBufferedImage |
scale(IcyBufferedImage source,
int width,
int height,
IcyBufferedImageUtil.FilterType filterType)
Return a copy of the image with specified size
|
static java.awt.image.BufferedImage |
toBufferedImage(IcyBufferedImage source,
java.awt.image.BufferedImage dest)
Draw the source
IcyBufferedImage into the destination BufferedImage If dest is null then a new TYPE_INT_ARGB BufferedImage is returned. |
static java.awt.image.BufferedImage |
toBufferedImage(IcyBufferedImage source,
java.awt.image.BufferedImage dest,
LUT lut)
Draw the source
IcyBufferedImage into the destination BufferedImage If dest is null then a new TYPE_INT_ARGB BufferedImage is returned. |
static java.awt.image.BufferedImage |
toBufferedImage(IcyBufferedImage source,
int imageType,
LUT lut)
Convert the current
IcyBufferedImage into a BufferedImage of the specified
type. |
static IcyBufferedImage |
toIcyBufferedImage(java.awt.image.BufferedImage image)
Deprecated.
Use
IcyBufferedImage.createFrom(BufferedImage) instead. |
static IcyBufferedImage |
toIcyBufferedImage(java.util.List<java.awt.image.BufferedImage> images)
Deprecated.
Use
IcyBufferedImage.createFrom(List) instead. |
static void |
translate(IcyBufferedImage source,
int dx,
int dy)
Translate image internal data (all channels) by the specified (x,y) vector.
|
static void |
translate(IcyBufferedImage source,
int dx,
int dy,
int channel)
Translate image internal data of specified channel by the specified (x,y) vector.
|
public IcyBufferedImageUtil()
@Deprecated public static IcyBufferedImage toIcyBufferedImage(java.awt.image.BufferedImage image)
IcyBufferedImage.createFrom(BufferedImage)
instead.@Deprecated public static IcyBufferedImage toIcyBufferedImage(java.util.List<java.awt.image.BufferedImage> images)
IcyBufferedImage.createFrom(List)
instead.public static java.awt.image.BufferedImage toBufferedImage(IcyBufferedImage source, java.awt.image.BufferedImage dest, LUT lut)
IcyBufferedImage
into the destination BufferedImage
dest
is null then a new TYPE_INT_ARGB BufferedImage
is returned.source
- source imagedest
- destination imagelut
- LUT
is used for color calculation (internal lut is used if null).public static java.awt.image.BufferedImage toBufferedImage(IcyBufferedImage source, java.awt.image.BufferedImage dest)
IcyBufferedImage
into the destination BufferedImage
dest
is null then a new TYPE_INT_ARGB BufferedImage
is returned.source
- source imagedest
- destination imagepublic static java.awt.image.BufferedImage toBufferedImage(IcyBufferedImage source, int imageType, LUT lut)
IcyBufferedImage
into a BufferedImage
of the specified
type.source
- source imageimageType
- wanted image type, only the following is accepted :lut
- lut used for color calculation (source image lut is used if null)public static java.awt.image.BufferedImage getARGBImage(IcyBufferedImage source, LUT lut, java.awt.image.BufferedImage dest)
IcyBufferedImage
into the destination ARGB BufferedImage
dest
is null then a new ARGB BufferedImage
is returned.toBufferedImage(IcyBufferedImage, BufferedImage, LUT)
but the output BufferedImage
is fixed to ARGB type (TYPE_INT_ARGB)source
- source imagedest
- destination imagelut
- LUT
is used for color calculation (internal lut is used if null).public static java.awt.image.BufferedImage getARGBImage(IcyBufferedImage source, java.awt.image.BufferedImage dest)
IcyBufferedImage
into the destination ARGB BufferedImage
dest
is null then a new ARGB BufferedImage
is returned.toBufferedImage(IcyBufferedImage, BufferedImage)
but
the output BufferedImage
is fixed to ARGB type (TYPE_INT_ARGB)source
- source imagedest
- destination imagepublic static java.awt.image.BufferedImage getARGBImage(IcyBufferedImage source, LUT lut)
IcyBufferedImage
into a ARGB BufferedImage
.source
- source imagelut
- LUT
is used for color calculation (internal lut is used if null).public static java.awt.image.BufferedImage getARGBImage(IcyBufferedImage source)
IcyBufferedImage
into a ARGB BufferedImage
.source
- source imagepublic static IcyBufferedImage convertToType(IcyBufferedImage source, DataType dataType, Scaler scaler)
source
- source imagedataType
- data type wantedscaler
- scaler for scaling internal data during conversionpublic static IcyBufferedImage convertToType(IcyBufferedImage source, DataType dataType, boolean rescale, boolean useDataBounds)
dataType
- Data type wantedrescale
- Indicate if we want to scale data value according to data (or data type) rangeuseDataBounds
- Only used when rescale
parameter is true.public static IcyBufferedImage convertToType(IcyBufferedImage source, DataType dataType, boolean rescale)
dataType
- data type wantedrescale
- indicate if we want to scale data value according to data type rangepublic static IcyBufferedImage getCopy(IcyBufferedImage source)
public static IcyBufferedImage getSubImage(IcyBufferedImage source, java.awt.Rectangle region, int c, int sizeC)
public static IcyBufferedImage getSubImage(IcyBufferedImage source, java.awt.Rectangle region)
@Deprecated public static IcyBufferedImage getSubImage(IcyBufferedImage source, int x, int y, int c, int sizeX, int sizeY, int sizeC)
getSubImage(IcyBufferedImage, Rectangle, int, int)
instead.public static IcyBufferedImage getSubImage(IcyBufferedImage source, int x, int y, int w, int h)
public static IcyBufferedImage extractChannel(IcyBufferedImage source, int channel)
@Deprecated public static IcyBufferedImage extractChannels(IcyBufferedImage source, java.util.List<java.lang.Integer> channelNumbers)
extractChannels(IcyBufferedImage, List)
instead.public static IcyBufferedImage extractChannels(IcyBufferedImage source, int... channels)
public static IcyBufferedImage addChannels(IcyBufferedImage source, int index, int num)
source
- source image.index
- position where we want to add channel(s).num
- number of channel(s) to add.public static IcyBufferedImage addChannel(IcyBufferedImage source, int index)
source
- source image.index
- position where we want to add channel.public static IcyBufferedImage addChannel(IcyBufferedImage source)
source
- source image.public static IcyBufferedImage rotate(IcyBufferedImage source, double xOrigin, double yOrigin, double angle, IcyBufferedImageUtil.FilterType filterType)
source
- source imagexOrigin
- X origin for the rotationyOrigin
- Y origin for the rotationangle
- rotation angle in radianfilterType
- filter resampling method usedpublic static IcyBufferedImage rotate(IcyBufferedImage source, double angle, IcyBufferedImageUtil.FilterType filterType)
source
- source imageangle
- rotation angle in radianfilterType
- filter resampling method usedpublic static IcyBufferedImage rotate(IcyBufferedImage source, double angle)
source
- source imageangle
- rotation angle in radianpublic static IcyBufferedImage scale(IcyBufferedImage source, int width, int height, boolean resizeContent, int xAlign, int yAlign, IcyBufferedImageUtil.FilterType filterType)
source
- source imageresizeContent
- indicate if content should be resized or not (empty area are 0 filled)xAlign
- horizontal image alignment (SwingConstants.LEFT / CENTER / RIGHT)yAlign
- vertical image alignment (SwingConstants.TOP / CENTER / BOTTOM)filterType
- filter method used for scale (used only if resizeContent is true)public static IcyBufferedImage scale(IcyBufferedImage source, int width, int height, boolean resizeContent, int xAlign, int yAlign)
source
- source imageresizeContent
- indicate if content should be resized or not (empty area are 0 filled)xAlign
- horizontal image alignment (SwingConstants.LEFT / CENTER / RIGHT)yAlign
- vertical image alignment (SwingConstants.TOP / CENTER / BOTTOM)public static IcyBufferedImage scale(IcyBufferedImage source, int width, int height, IcyBufferedImageUtil.FilterType filterType)
source
- source imagefilterType
- filter method used for scale (used only if resizeContent is true)public static IcyBufferedImage scale(IcyBufferedImage source, int width, int height)
public static void translate(IcyBufferedImage source, int dx, int dy, int channel)
public static void translate(IcyBufferedImage source, int dx, int dy)