|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.media.jai.codec.TIFFEncodeParam
An instance of ImageEncodeParam
for encoding images in
the TIFF format.
This class allows for the specification of encoding parameters. By
default, the image is encoded without any compression, and is written
out consisting of strips, not tiles. The particular compression scheme
to be used can be specified by using the setCompression()
method. The compression scheme specified will be honored only if it is
compatible with the type of image being written out. For example,
Group3 and Group4 compressions can only be used with Bilevel images.
Writing of tiled TIFF images can be enabled by calling the
setWriteTiled()
method.
This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.
Field Summary | |
static int |
COMPRESSION_DEFLATE
DEFLATE lossless compression (also known as "Zip-in-TIFF"). |
static int |
COMPRESSION_GROUP3_1D
Modified Huffman Compression (CCITT Run Length Encoding (RLE)). |
static int |
COMPRESSION_GROUP3_2D
CCITT T.4 bilevel compression (Group 3 facsimile compression). |
static int |
COMPRESSION_GROUP4
CCITT T.6 bilevel compression (Group 4 facsimile compression). |
static int |
COMPRESSION_JPEG_TTN2
JPEG-in-TIFF compression. |
static int |
COMPRESSION_LZW
LZW compression. |
static int |
COMPRESSION_NONE
No compression. |
static int |
COMPRESSION_PACKBITS
Byte-oriented run-length encoding "PackBits" compression. |
Constructor Summary | |
TIFFEncodeParam()
Constructs a TIFFEncodeParam object with default values for all parameters. |
Method Summary | |
int |
getCompression()
Returns the value of the compression parameter. |
int |
getDeflateLevel()
Gets the compression level for DEFLATE compression. |
TIFFField[] |
getExtraFields()
Returns the value set by setExtraFields() . |
Iterator |
getExtraImages()
Returns the additional image Iterator specified via
setExtraImages() or null if none was
supplied or if a null value was supplied. |
boolean |
getJPEGCompressRGBToYCbCr()
Whether RGB data will be converted to YCbCr when using JPEG compression. |
JPEGEncodeParam |
getJPEGEncodeParam()
Retrieves the JPEG compression parameters. |
boolean |
getLittleEndian()
Returns the value of the flag indicating whether the output stream byte order is little endian. |
boolean |
getReverseFillOrder()
Returns value of flag indicating whether CCITT-compressed bilevel data should be filled in reverse order. |
boolean |
getT4Encode2D()
Returns value of flag indicating whether T4-compressed bilevel data should be two-dimensionally encoded. |
boolean |
getT4PadEOLs()
Returns value of flag indicating whether T4-compressed bilevel data should have the embedded EOL bit sequences padded to byte alignment. |
int |
getTileHeight()
Retrieves the tile height set via setTileSize() . |
int |
getTileWidth()
Retrieves the tile width set via setTileSize() . |
boolean |
getWriteTiled()
Returns the value of the writeTiled parameter. |
void |
setCompression(int compression)
Specifies the type of compression to be used. |
void |
setDeflateLevel(int deflateLevel)
Sets the compression level for DEFLATE-compressed data which should either be java.util.Deflater.DEFAULT_COMPRESSION or a
value in the range [1,9] where larger values indicate more compression. |
void |
setExtraFields(TIFFField[] extraFields)
Sets an array of extra fields to be written to the TIFF Image File Directory (IFD). |
void |
setExtraImages(Iterator extraImages)
Sets an Iterator of additional images to be written
after the image passed as an argument to the ImageEncoder . |
void |
setJPEGCompressRGBToYCbCr(boolean convertJPEGRGBToYCbCr)
Sets flag indicating whether to convert RGB data to YCbCr when the compression type is JPEG. |
void |
setJPEGEncodeParam(JPEGEncodeParam jpegEncodeParam)
Sets the JPEG compression parameters. |
void |
setLittleEndian(boolean isLittleEndian)
Sets a flag indicating whether the byte order used to write the output stream is little endian. |
void |
setReverseFillOrder(boolean reverseFillOrder)
Set value of flag indicating whether CCITT-compressed bilevel data should be filled in reverse order. |
void |
setT4Encode2D(boolean T4Encode2D)
Set value of flag indicating whether T4-compressed bilevel data should be two-dimensionally encoded. |
void |
setT4PadEOLs(boolean T4PadEOLs)
Sets value of flag indicating whether T4-compressed bilevel data should have the embedded EOL bit sequences padded to byte alignment. |
void |
setTileSize(int tileWidth,
int tileHeight)
Sets the dimensions of the tiles to be written. |
void |
setWriteTiled(boolean writeTiled)
If set, the data will be written out in tiled format, instead of in strips. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int COMPRESSION_NONE
public static final int COMPRESSION_PACKBITS
public static final int COMPRESSION_GROUP3_1D
public static final int COMPRESSION_GROUP3_2D
public static final int COMPRESSION_GROUP4
public static final int COMPRESSION_LZW
Not supported.
public static final int COMPRESSION_JPEG_TTN2
public static final int COMPRESSION_DEFLATE
Constructor Detail |
public TIFFEncodeParam()
Method Detail |
public int getCompression()
public void setCompression(int compression)
If compression
is set to any value but
COMPRESSION_NONE
and the OutputStream
supplied to the ImageEncoder
is not a
SeekableOutputStream
, then the encoder will use either
a temporary file or a memory cache when compressing the data
depending on whether the file system is accessible. Compression
will therefore be more efficient if a SeekableOutputStream
is supplied.
compression
- The compression type.public boolean getReverseFillOrder()
setReverseFillOrder(boolean)
public void setReverseFillOrder(boolean reverseFillOrder)
true
,
pixels are arranged within a byte such that pixels with lower
column values are stored in the lower order bits of the byte.
Thus true
corresponds to TIFF FillOrder value 2
and false
to TIFF FillOrder 1. The default
value is false
.public boolean getT4Encode2D()
setT4Encode2D(boolean)
public void setT4Encode2D(boolean T4Encode2D)
true
the
data are two-dimensionally encoded; if false
they
are one-dimensionally encoded. The default value is true
.public boolean getT4PadEOLs()
setT4PadEOLs(boolean)
public void setT4PadEOLs(boolean T4PadEOLs)
true
, zero-valued bits are prepended to each EOL
bit sequence 0x001
such that the EOL is right-aligned
on a byte boundary:
xxxx-0000 0000-0001where "x" denotes a value which could be either data or a fill bit depending on the alignment of the data before the EOL. The default value is
false
.public boolean getWriteTiled()
public void setWriteTiled(boolean writeTiled)
writeTiled
- Specifies whether the image data should be
wriiten out in tiled format.public void setTileSize(int tileWidth, int tileHeight)
If the data are being written as tiles, i.e.,
getWriteTiled()
returns true
, then the
default tile dimensions used by the encoder are those of the tiles
of the image being encoded.
If the data are being written as strips, i.e.,
getWriteTiled()
returns false
, the width
of each strip is always the width of the image and the default
number of rows per strip is 8.
If JPEG compession is being used, the dimensions of the strips or tiles may be modified to conform to the JPEG-in-TIFF specification.
tileWidth
- The tile width; ignored if strips are used.tileHeight
- The tile height or number of rows per strip.public int getTileWidth()
setTileSize()
.public int getTileHeight()
setTileSize()
.public void setExtraImages(Iterator extraImages)
Iterator
of additional images to be written
after the image passed as an argument to the ImageEncoder
.
The methods on the supplied Iterator
must only be invoked
by the ImageEncoder
which will exhaust the available
values unless an error occurs.
The value returned by an invocation of next()
on the
Iterator
must return either a RenderedImage
or an Object[]
of length 2 wherein the element at index
zero is a RenderedImage
amd the other element is a
TIFFEncodeParam
. If no TIFFEncodeParam
is
supplied in this manner for an additional image, the parameters used
to create the ImageEncoder
will be used. The extra
image Iterator
set on any TIFFEncodeParam
of an additional image will in all cases be ignored.
public Iterator getExtraImages()
Iterator
specified via
setExtraImages()
or null
if none was
supplied or if a null
value was supplied.public void setDeflateLevel(int deflateLevel)
java.util.Deflater.DEFAULT_COMPRESSION
or a
value in the range [1,9] where larger values indicate more compression.
The default setting is Deflater.DEFAULT_COMPRESSION
. This
setting is ignored if the compression type is not DEFLATE.public int getDeflateLevel()
public void setJPEGCompressRGBToYCbCr(boolean convertJPEGRGBToYCbCr)
true
.
This flag is ignored if the compression type is not JPEG.public boolean getJPEGCompressRGBToYCbCr()
public void setJPEGEncodeParam(JPEGEncodeParam jpegEncodeParam)
null
to indicate that default compression parameters
are to be used. For maximum conformance with the specification it
is recommended in most cases that only the quality compression
parameter be set.
The writeTablesOnly
and JFIFHeader
flags of the JPEGEncodeParam
are ignored. The
writeImageOnly
flag is used to determine whether the
JPEGTables field will be written to the TIFF stream: if
writeImageOnly
is true
, then the JPEGTables
field will be written and will contain a valid JPEG abbreviated
table specification datastream. In this case the data in each data
segment (strip or tile) will contain an abbreviated JPEG image
datastream. If the writeImageOnly
flag is
false
, then the JPEGTables field will not be written and
each data segment will contain a complete JPEG interchange datastream.
public JPEGEncodeParam getJPEGEncodeParam()
public void setExtraFields(TIFFField[] extraFields)
extraFields
- An array of extra fields; the parameter is
copied by reference.public TIFFField[] getExtraFields()
setExtraFields()
.public void setLittleEndian(boolean isLittleEndian)
true
multi-byte data units such as 16-bit and 32-bit integers and 32-bit
floating point values are written from the least to the most
significant byte; if false
the order is from most to
least significant byte. The default value is false
.public boolean getLittleEndian()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |