An instance of ImageDecodeParam for decoding images in
the TIFF format.
To determine the number of images present in a TIFF file, use
the getNumPages() method on the
ImageDecoder object that will be used to perform the
decoding. The desired page number may be passed as an argument to
the ImageDecoder.decodeAsRaster)() or
decodeAsRenderedImage() methods.
For TIFF Palette color images, the colorMap always has entries
of short data type, the color Black being represented by 0,0,0 and
White by 65536,65536,65536. In order to display these images, the
default behavior is to dither the short values down to 8 bits.
The dithering is done by calling the decode16BitsTo8Bits
method for each short value that needs to be dithered. The method has
the following implementation:
byte b;
short s;
s = s & 0xffff;
b = (byte)((s >> 8) & 0xff);
If a different algorithm is to be used for the dithering, this class
should be subclassed and an appropriate implementation should be
provided for the decode16BitsTo8Bits method in the subclass.
If the palette contains image data that is signed short, as specified
by the SampleFormat tag, the dithering is done by calling
decodeSigned16BitsTo8Bits instead. The method has the
following implementation:
byte b;
short s;
b = (byte)((s + Short.MIN_VALUE) >> 8);
In order to use a different algorithm for the dithering, this class
should be subclassed and the method overridden.
If it is desired that the Palette be decoded such that the output
image is of short data type and no dithering is performed, the
setDecodePaletteAsShorts method should be used.
This class is not a committed part of the JAI API. It may
be removed or changed in future releases of JAI.
See Also: TIFFDirectory |