public final class ImageInfo
extends java.lang.Object
Special image type.
To easily support passing in image and their DPI information (which is not easily extracted in Java)
this special type is recognized and processed by Templater
implementations.
Modifier and Type | Class and Description |
---|---|
static class |
ImageInfo.Builder
ImageInfo builder for easier initialization.
|
Modifier and Type | Field and Description |
---|---|
byte[] |
content
Image content as stored on disk
|
java.lang.String |
extension
Extension to use (eg: png, gif, jpg,...)
|
int |
height
Height of the image, eg: 400
|
float |
horizontalResolution
Horizontal DPI of the image, eg: 96
|
float |
verticalResolution
Vertical DPI of the image, eg: 96
|
int |
width
Width of the image, eg: 600
|
Constructor and Description |
---|
ImageInfo(byte[] content,
java.lang.String extension,
int width,
float horizontalResolution,
int height,
float verticalResolution)
Full ImageInfo constructor where horizontal and vertical DPI can be different
|
ImageInfo(byte[] content,
java.lang.String extension,
int width,
int height,
float resolution)
Basic ImageInfo constructor with same horizontal and vertical DPI
|
Modifier and Type | Method and Description |
---|---|
static ImageInfo.Builder |
from(byte[] content)
ImageInfo builder from byte array
|
static ImageInfo.Builder |
from(java.io.InputStream stream)
ImageInfo builder from a stream.
|
public final byte[] content
public final java.lang.String extension
public final int width
public final float horizontalResolution
public final int height
public final float verticalResolution
public ImageInfo(byte[] content, java.lang.String extension, int width, int height, float resolution)
content
- content as saved on diskextension
- filename extension (eg, png, jpg, ...)width
- image widthheight
- image heightresolution
- DPIpublic ImageInfo(byte[] content, java.lang.String extension, int width, float horizontalResolution, int height, float verticalResolution)
content
- content as saved on diskextension
- filename extension (eg, png, jpg, ...)width
- image widthhorizontalResolution
- horizontal DPIheight
- image heightverticalResolution
- vertical DPIpublic static ImageInfo.Builder from(byte[] content)
content
- disk representation of an imagepublic static ImageInfo.Builder from(java.io.InputStream stream) throws java.io.IOException
stream
- image content as stored on diskjava.io.IOException
- errors reading from stream