Class TIFFDescriptor

All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class TIFFDescriptor
extends OperationDescriptorImpl

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 TIFFFields 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();

 TIFFDecodeParam param = new TIFFDecodeParam();

 java.util.ArrayList images = new ArrayList();
 long nextOffset = 0;
 do {
     RenderedOp op = JAI.create("tiff", pb);
     TIFFDirectory dir = (TIFFDirectory)op.getProperty("tiff_directory");
     nextOffset = dir.getNextIFDOffset();
     if(nextOffset != 0) {
 } while(nextOffset != 0);

The classes in the 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
Description Reads a TIFF 6.0 file.
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
param null
page java.lang.Integer 0

See Also:
SeekableStream, TIFFDecodeParam, TIFFDirectory, TIFFEncodeParam, TIFFField, OperationDescriptor, EncodeDescriptor, Serialized Form

Field Summary
Fields inherited from class
sourceNames, supportedModes
Fields inherited from interface
Constructor Summary
Method Summary
static RenderedOp create(SeekableStream stream, TIFFDecodeParam param, Integer page, RenderingHints hints)
          Reads TIFF 6.0 data from an SeekableStream.
Methods inherited from class
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateArguments, validateParameters, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public TIFFDescriptor()

Method Detail


public static RenderedOp create(SeekableStream stream,
                                TIFFDecodeParam param,
                                Integer page,
                                RenderingHints hints)
Reads TIFF 6.0 data from an SeekableStream.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(String,ParameterBlock,RenderingHints).

stream - The SeekableStream to read from.
param - The TIFFDecodeParam to use. May be null.
page - The page to be decoded. May be null.
hints - The RenderingHints to use. May be null.
The RenderedOp destination.
IllegalArgumentException - if stream is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp