public abstract class TIFFBaseJPEGCompressor extends TIFFCompressor
Modifier and Type | Field and Description |
---|---|
protected static String |
IMAGE_METADATA_NAME |
protected JPEGImageWriteParam |
JPEGParam
ImageWriteParam for JPEG writer.
|
protected IIOMetadata |
JPEGStreamMetadata
Stream metadata equivalent to a tables-only stream such as in
the
JPEGTables . |
protected ImageWriter |
JPEGWriter
The JPEG writer.
|
protected static String |
STREAM_METADATA_NAME |
protected boolean |
writeAbbreviatedStream
Whether to write abbreviated JPEG streams (default == false).
|
compressionTagValue, compressionType, isCompressionLossless, metadata, stream, writer
Constructor and Description |
---|
TIFFBaseJPEGCompressor(String compressionType,
int compressionTagValue,
boolean isCompressionLossless,
ImageWriteParam param) |
Modifier and Type | Method and Description |
---|---|
int |
encode(byte[] b,
int off,
int width,
int height,
int[] bitsPerSample,
int scanlineStride)
Encodes the supplied image data, writing to the currently set
ImageOutputStream . |
protected void |
finalize() |
protected void |
initJPEGWriter(boolean supportsStreamMetadata,
boolean supportsImageMetadata)
Initializes the JPEGWriter and JPEGParam instance variables.
|
getCompressionTagValue, getCompressionType, getMetadata, getStream, getWriter, isCompressionLossless, setMetadata, setStream, setWriter
protected static final String STREAM_METADATA_NAME
protected static final String IMAGE_METADATA_NAME
protected JPEGImageWriteParam JPEGParam
#initJPEGWriter()
.protected ImageWriter JPEGWriter
#initJPEGWriter()
.protected boolean writeAbbreviatedStream
true
should also
initialized JPEGStreamMetadata
.protected IIOMetadata JPEGStreamMetadata
JPEGTables
. Default value is null
.
This should be set by any subclass which sets
writeAbbreviatedStream
to true
.public TIFFBaseJPEGCompressor(String compressionType, int compressionTagValue, boolean isCompressionLossless, ImageWriteParam param)
protected void initJPEGWriter(boolean supportsStreamMetadata, boolean supportsImageMetadata)
supportsStreamMetadata
- Whether the JPEG writer must
support JPEG native stream metadata, i.e., be capable of writing
abbreviated streams.supportsImageMetadata
- Whether the JPEG writer must
support JPEG native image metadata.public final int encode(byte[] b, int off, int width, int height, int[] bitsPerSample, int scanlineStride) throws IOException
TIFFCompressor
ImageOutputStream
.encode
in class TIFFCompressor
b
- an array of byte
s containing the packed
but uncompressed image data.off
- the starting offset of the data to be written in the
array b
.width
- the width of the rectangle of pixels to be written.height
- the height of the rectangle of pixels to be written.bitsPerSample
- an array of int
s indicting
the number of bits used to represent each image sample within
a pixel.scanlineStride
- the number of bytes separating each
row of the input data.IOException
- if the supplied data cannot be encoded by
this TIFFCompressor
, or if any I/O error occurs
during writing.Copyright © 2015–2022 SCIFIO. All rights reserved.