Image Options
JDeli includes a EncoderOptions class for each format it can write, these classes allow you to have greater control over the options used during the encoding. You can use these options by setting them in the class that matches the file type you wish to encode to and pass it into either of the following methods.
- JDeli.write(BufferedImage, EncoderOptions, File)
- JDeli.write(BufferedImage, EncoderOptions, OutputStream)
- JDeli.convert(File, EncoderOptions, File)
List of Image Options in JDeli
BMP
No additional options are currently available for this format.
HEIC
No additional options are currently available for this format.
JPEG
Quality
Control the image quality level for JPEG output. Higher values produce better quality JPEG files but increase the output data size.
This can be set using JpegEncoderOptions.setQuality(int).
Accepted Values
1 - 100
Default Value
75
JPEG 2000
Output Subtype
Controls the type of JPEG2000 this file is encoded as, JP2 or JPX.
This can be set using Jpeg2000EncoderOptions.getOutputSubtype(Jpeg2000OutputSubtype).
Accepted Values
Any value of the Jpeg2000OutputSubtype enum
Default Value
Jpeg2000OutputSubtype.JPX
Quality
Control the image quality level for JPEG output. Higher values produce better quality JPEG files but increase the output data size.
This can be set using Jpeg2000EncoderOptions.setQuality(int).
Accepted Values
1 - 100
Default Value
50
No additional options are currently available for this format.
PNG
Compression
Sets the type of compression to be used when encoding the image.
This can be set using PngEncoderOptions.setCompressionFormat(PngCompressionFormat).
Accepted Values
Any value of the PngCompressionFormat enum
Default Value
PngCompressionFormat.ZLIB_BETTER_COMPRESSION
Optimize Based On Colors
Set a flag that requires JDeli to optimize the file based one the color content
This can be set using PngEncoderOptions.setOptimizeBasedOnColors(boolean).
Accepted Values
- true
- false
Default Value
false
TIFF
Compression
Set the type of compression to be used when encoding the image.
This can be set using TiffEncoderOptions.setCompressionFormat(TiffCompressionFormat).
Accepted Values
Any value of the TiffCompressionFormat enum
Default Value
TiffCompressionFormat.DEFLATE_BETTER_COMPRESSION
Resolution Units
Set the units used for the resolution.
This can be set using TiffEncoderOptions.setResolutionUnit(TiffResolutionUnit).
Accepted Values
Any value of the TiffResolutionUnit enum
Default Value
TiffResolutionUnit.NONE
Resolution X
Set the x resolution for this image
This can be set using TiffEncoderOptions.setXResolution(int).
Accepted Values
Any positive integer value or -1 to leave unset in file
Default Value
-1
Resolution Y
Set the y resolution for this image
This can be set using TiffEncoderOptions.setYResolution(int).
Accepted Values
Any positive integer value or -1 to leave unset in file
Default Value
-1
Xmp Metadata
Sets the metadata for this file.
This can be set using TiffEncoderOptions.setXmpMetaData(String).
Accepted Values
A String representing the metadata for this file
Default Value
None
WEBP
Compression
Set the type of compression to be used when encoding the image.
This can be set using WebpEncoderOptions.setCompressionFormat(WebpCompressionFormat).
Accepted Values
Any value of the WebpCompressionFormat enum
Default Value
WebpCompressionFormat.LOSSY