An OperationDescriptor describing the "TIFF" operation.
The "TIFF" operation reads TIFF data from a SeekableStream .
TIFF version 6.0 was finalized in June, 1992. Since that time
there have been two technical notes extending the specification.
There are also a number of
TIFF Extensions including
GeoTIFF.
The TIFF format consists of a short header that points to a
linked list of Image File Directories (IFDs). An IFD is
essentially a list of fields. The TIFFDirectory class
encapsulates a set of common operations performed on an IFD; an instance
of the TIFFField class corresponds to a field in an IFD.
Each field has numeric value or tag, a data type, and a byte offset
at which the field's data may be found. This mechanism allows TIFF
files to contain multiple images, each with its own IFD, and to order
its contents flexibly since (apart from the header) nothing is required to
appear at a fixed offset.
An image generated by the "TIFF" operation will have a property
named "tiff_directory" the value of which will be a TIFFDirectory
corresponding to the IFD of the image. JAI's property inheritance mechanism
provides a mechanism by which the field information of the IFD may be
made available to applications in a straightforward way. This mechanism
may be utilized by setting a PropertyGenerator on this
OperationDescriptor which extracts TIFFField s
from the TIFFDirectory -valued property and returns them either
as TIFFField instances or as some user-defined object
initialized from a TIFFField . In the latter case application
code would be insulated from the uncommitted TIFFField class.
The second parameter contains an instance of
TIFFDecodeParam to be used during the decoding.
It may be set to null in order to perform default
decoding, or equivalently may be omitted.
Some TIFF extensions make use of a mechanism known as "private
IFDs." A private IFD is one that is not referenced by the standard
linked list of IFDs that starts in the file header. To a standard
TIFF reader, it appears as an unreferenced area in the file.
However, the byte offset of the private IFD is stored as the value
of a private tag, allowing readers that understand the tag to
locate and interpret the IFD. The "TIFF" operation may read the data
at an arbitrary IFD by supplying the offset of the IFD via the
setIFDOffset() method of the TIFFDecodeParam
parameter.
The third parameter specifies which page of the TIFF data to
read. This permits loading of multi-page TIFF files. The value
provided is zero-relative and so may be interpreted as the index
of the IFD after the first IFD in the stream with zero of course
indicating the first IFD. The default value is zero.
All pages of a multi-page TIFF stream may also be read by doing the
following:
SeekableStream s; // initialization omitted
ParameterBlock pb = new ParameterBlock();
pb.add(s);
TIFFDecodeParam param = new TIFFDecodeParam();
pb.add(param);
java.util.ArrayList images = new ArrayList();
long nextOffset = 0;
do {
RenderedOp op = JAI.create("tiff", pb);
images.add(op);
TIFFDirectory dir = (TIFFDirectory)op.getProperty("tiff_directory");
nextOffset = dir.getNextIFDOffset();
if(nextOffset != 0) {
param.setIFDOffset(nextOffset);
}
} while(nextOffset != 0);
The classes in the com.sun.media.jai.codec
package are not a committed part of the JAI API. Future releases
of JAI will make use of new classes in their place. This
class will change accordingly.
Resource List
Name | Value |
GlobalName | TIFF |
LocalName | TIFF |
Vendor | com.sun.media.jai |
Description | Reads a TIFF 6.0 file. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/TIFFDescriptor.html |
Version | 1.0 |
arg0Desc | The SeekableStream to read from. |
arg1Desc | The TIFFDecodeParam to use. |
arg2Desc | The page to be decoded. |
Parameter List
Name | Class Type |
Default Value |
stream | com.sun.media.jai.codec.SeekableStream |
NO_PARAMETER_DEFAULT |
param | com.sun.media.jai.codec.TIFFDecodeParam |
null |
page | java.lang.Integer |
0 |
See Also: com.sun.media.jai.codec.SeekableStream See Also: com.sun.media.jai.codec.TIFFDecodeParam See Also: com.sun.media.jai.codec.TIFFDirectory See Also: com.sun.media.jai.codec.TIFFEncodeParam See Also: com.sun.media.jai.codec.TIFFField See Also: javax.media.jai.OperationDescriptor See Also: javax.media.jai.operator.EncodeDescriptor |