Package com.idrsolutions.image.tiff
Class TiffEncoder
java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.tiff.TiffEncoder
- All Implemented Interfaces:
com.idrsolutions.image.Encoder
public class TiffEncoder
extends com.idrsolutions.image.JDeliImage
implements com.idrsolutions.image.Encoder
Class writes BufferedImages as Tiff
Example 1 (single-page tiff):
TiffEncoder encoder = new TiffEncoder();
encoder.getEncoderOptions().setCompressionFormat(TiffCompressionFormat.DEFLATE); //default is NONE
encoder.write(image, bos);
Example 2 (multi-page tiff)
TiffEncoder encoder = new TiffEncoder();
for (BufferedImage image : yourImageArray) {
encoder.append(image, fileName);
}
-
Field Summary
Fields inherited from class com.idrsolutions.image.JDeliImage
bb -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]append(BufferedImage image, byte[] out) Appends image to byte arrayvoidappend(BufferedImage image, String fileName) Appends image to specified tiff filebooleanDeprecated.usevoidsetCompressed(boolean compress) Deprecated.usevoidsetEncoderOptions(TiffEncoderOptions tiffEncoderOptions) voidsetXMPMetaData(String xmpMetaData) Deprecated.usevoidwrite(BufferedImage image, OutputStream outputStream) Writes BufferedImage as Tiff to OutputStreamMethods inherited from class com.idrsolutions.image.JDeliImage
optimiseImage
-
Constructor Details
-
TiffEncoder
-
TiffEncoder
public TiffEncoder()
-
-
Method Details
-
write
Writes BufferedImage as Tiff to OutputStreamThis method does not close the provided OutputStream after the write operation has completed; it is the responsibility of the caller to close the stream.
- Specified by:
writein interfacecom.idrsolutions.image.Encoder- Parameters:
image- BufferedImage The image to writeoutputStream- The stream to write to- Throws:
IOException- if the image wasn't written
-
append
Appends image to specified tiff fileIf the file is empty then this method will write the image to the file, otherwise it will append the image after previous image.
- Parameters:
image- BufferedImage The image to appendfileName- The name of the file where the image will be written- Throws:
IOException- if the file is unreadable
-
append
Appends image to byte arrayIf the array is empty then this method will write the image, otherwise it will append the image after previous image.
- Parameters:
image- BufferedImage The image to appendout- The byte array where the image will be written- Throws:
IOException
-
isCompressed
Deprecated.usegetEncoderOptions().getCompressionFormat().equals(TiffCompressionFormat.DEFLATE);Returns whether Deflate compression is enabled in tiff generation.- Returns:
- Whether compression is enabled
-
getEncoderOptions
- Specified by:
getEncoderOptionsin interfacecom.idrsolutions.image.Encoder
-
setEncoderOptions
-
setCompressed
Deprecated.usetiffEncoderOptions.setCompressionFormat(TiffCompressionFormat tiffCompression); setEncoderOptions(tiffEncoderOptions);- Parameters:
compress- value to determine if compression used
-
setXMPMetaData
Deprecated.usetiffEncoderOptions.setXmpMetaData("string"); setEncoderOptions(tiffEncoderOptions);set XMP MetaData to be written on images;- Parameters:
xmpMetaData- header data for Tiff file
-