public final class Images extends Object
Modifier and Type | Method and Description |
---|---|
static String |
base64(RenderedImage image) |
static <T extends RealType<T>> |
bufferedImage(Dataset source)
Converts the given
Dataset to a BufferedImage . |
static <T extends RealType<T>> |
bufferedImage(RandomAccessibleInterval<T> source)
Converts the given
RandomAccessibleInterval to a
BufferedImage . |
static <T extends RealType<T>> |
bufferedImage(RandomAccessibleInterval<T> source,
double[] min,
double[] max)
Converts the given
RandomAccessibleInterval to a
BufferedImage . |
static <T extends RealType<T>> |
bufferedImage(RandomAccessibleInterval<T> source,
double min,
double max)
Converts the given
RandomAccessibleInterval to a
BufferedImage . |
static <T extends RealType<T>> |
bufferedImage(RandomAccessibleInterval<T> source,
int xAxis,
int yAxis,
int cAxis,
double[] min,
double[] max,
long... pos)
Converts the given
RandomAccessibleInterval to a
BufferedImage . |
static <T extends RealType<T>> |
bufferedImage(RandomAccessibleInterval<T> source,
int xAxis,
int yAxis,
int cAxis,
NotebookService.ValueScaling scaling,
long... pos)
Converts the given
RandomAccessibleInterval to a
BufferedImage . |
static BufferedImage |
decode(byte[] data)
Converts the given byte array into a
BufferedImage . |
static byte[] |
encode(RenderedImage image)
Converts the given
RenderedImage into a stream of PNG bytes. |
static byte[] |
encode(RenderedImage image,
String format)
Converts the given
RenderedImage into a stream of bytes. |
static String |
html(RenderedImage image) |
static String |
html(RenderedImage image,
String title) |
public static byte[] encode(RenderedImage image) throws IOException
RenderedImage
into a stream of PNG bytes.image
- The image to convert to a byte stream.IOException
public static byte[] encode(RenderedImage image, String format) throws IOException
RenderedImage
into a stream of bytes.image
- The image to convert to a byte stream.format
- The informal name of the format for the returned bytes; e.g.
"png" or "jpg". See
ImageIO.getImageWritersByFormatName(String)
.IOException
public static BufferedImage decode(byte[] data) throws IOException
BufferedImage
.data
- The bytes to convert to an image.BufferedImage
of the given bytes, or null if an image
cannot be decoded from the specified data stream.IOException
public static String base64(RenderedImage image) throws IOException
IOException
public static String html(RenderedImage image) throws IOException
IOException
public static String html(RenderedImage image, String title) throws IOException
IOException
public static <T extends RealType<T>> BufferedImage bufferedImage(Dataset source)
Dataset
to a BufferedImage
.source
- The image to render.BufferedImage
representation.public static <T extends RealType<T>> BufferedImage bufferedImage(RandomAccessibleInterval<T> source)
RandomAccessibleInterval
to a
BufferedImage
.source
- The image to render.BufferedImage
representation.public static <T extends RealType<T>> BufferedImage bufferedImage(RandomAccessibleInterval<T> source, double min, double max)
RandomAccessibleInterval
to a
BufferedImage
.source
- The image to render.min
- The minimum value allowed on the display.max
- The maximum value allowed on the display.BufferedImage
representation.public static <T extends RealType<T>> Object bufferedImage(RandomAccessibleInterval<T> source, double[] min, double[] max)
RandomAccessibleInterval
to a
BufferedImage
.source
- The image to render.min
- The minimum value per dimension allowed on the display.max
- The maximum value per dimension allowed on the display.BufferedImage
representation.public static <T extends RealType<T>> BufferedImage bufferedImage(RandomAccessibleInterval<T> source, int xAxis, int yAxis, int cAxis, NotebookService.ValueScaling scaling, long... pos)
RandomAccessibleInterval
to a
BufferedImage
.source
- The image to render.xAxis
- The image dimension to use for the X axis.yAxis
- The image dimension to use for the Y axis.cAxis
- The image dimension to use for compositing multiple channels,
or -1 for no compositing.scaling
- Value scaling strategy; see NotebookService.ValueScaling
.pos
- Dimensional position of the image. Passing null or the empty
array will display the default (typically the first) position.BufferedImage
representation.public static <T extends RealType<T>> BufferedImage bufferedImage(RandomAccessibleInterval<T> source, int xAxis, int yAxis, int cAxis, double[] min, double[] max, long... pos)
RandomAccessibleInterval
to a
BufferedImage
.source
- The image to render.xAxis
- The image dimension to use for the X axis.yAxis
- The image dimension to use for the Y axis.cAxis
- The image dimension to use for compositing multiple channels,
or -1 for no compositing.min
- The minimum value per dimension allowed on the displaymax
- The maximum value per dimension allowed on the displaypos
- Dimensional position of the image. Passing null or the empty
array will display the default (typically the first) position.BufferedImage
representation.Copyright © 2014–2022 ImageJ. All rights reserved.