TIFFImageReadParam (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: javax.imageio.plugins.tiff, class: TIFFImageReadParam
Keywords: javax.imageio.plugins.tiff.TIFFImageReadParam class

# Class TIFFImageReadParam

java.lang.Object
javax.imageio.IIOParam
javax.imageio.ImageReadParam
javax.imageio.plugins.tiff.TIFFImageReadParam

public final class TIFFImageReadParam extends ImageReadParam
A subclass of `ImageReadParam` allowing control over the TIFF reading process.

Because TIFF is an extensible format, the reader requires information about any tags used by TIFF extensions in order to emit meaningful metadata. Also, TIFF extensions may define new compression types. Both types of information about extensions may be provided by this interface.

Additional TIFF tags must be organized into `TIFFTagSet`s. A `TIFFTagSet` may be provided to the reader by means of the `addAllowedTagSet` method. By default, the tag sets `BaselineTIFFTagSet`, `FaxTIFFTagSet`, `ExifParentTIFFTagSet`, and `GeoTIFFTagSet` are included.

Forcing reading of fields corresponding to `TIFFTag`s not in any of the allowed `TIFFTagSet`s may be effected via `setReadUnknownTags`.

Since:
  9

- ## Field Summary

  ### Fields declared in class ImageReadParam

  `canSetSourceRenderSize, destination, destinationBands, minProgressivePass, numProgressivePasses, sourceRenderSize`
  Modifier and Type
  Field
  Description
  `protected boolean`
  `canSetSourceRenderSize`
  `true` if this `ImageReadParam` allows the source rendering dimensions to be set.
  `protected BufferedImage`
  `destination`
  The current destination `BufferedImage`, or `null` if none has been set.
  `protected int[]`
  `destinationBands`
  The set of destination bands to be used, as an array of `int`s.
  `protected int`
  `minProgressivePass`
  The minimum index of a progressive pass to read from the source.
  `protected int`
  `numProgressivePasses`
  The maximum number of progressive passes to read from the source.
  `protected Dimension`
  `sourceRenderSize`
  The desired rendering width and height of the source, if `canSetSourceRenderSize` is `true`, or `null`.

  ### Fields declared in class IIOParam

  `controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffset`
  Modifier and Type
  Field
  Description
  `protected IIOParamController`
  `controller`
  The `IIOParamController` that will be used to provide settings for this `IIOParam` object when the `activateController` method is called.
  `protected IIOParamController`
  `defaultController`
  The default `IIOParamController` that will be used to provide settings for this `IIOParam` object when the `activateController` method is called.
  `protected Point`
  `destinationOffset`
  The offset in the destination where the upper-left decoded pixel should be placed.
  `protected ImageTypeSpecifier`
  `destinationType`
  An `ImageTypeSpecifier` to be used to generate a destination image when reading, or to set the output color type when writing.
  `protected int[]`
  `sourceBands`
  An array of `int`s indicating which source bands will be used, or `null`.
  `protected Rectangle`
  `sourceRegion`
  The source region, on `null` if none is set.
  `protected int`
  `sourceXSubsampling`
  The decimation subsampling to be applied in the horizontal direction.
  `protected int`
  `sourceYSubsampling`
  The decimation subsampling to be applied in the vertical direction.
  `protected int`
  `subsamplingXOffset`
  A horizontal offset to be applied to the subsampling grid before subsampling.
  `protected int`
  `subsamplingYOffset`
  A vertical offset to be applied to the subsampling grid before subsampling.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TIFFImageReadParam()`
  Constructs a `TIFFImageReadParam`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAllowedTagSet(TIFFTagSet tagSet)`
  Adds a `TIFFTagSet` object to the list of allowed tag sets.
  `List<TIFFTagSet>`
  `getAllowedTagSets()`
  Returns a `List` containing the allowed `TIFFTagSet` objects.
  `boolean`
  `getReadUnknownTags()`
  Retrieve the setting of whether to read fields corresponding to unknown `TIFFTag`s.
  `void`
  `removeAllowedTagSet(TIFFTagSet tagSet)`
  Removes a `TIFFTagSet` object from the list of allowed tag sets.
  `void`
  `setReadUnknownTags(boolean readUnknownTags)`
  Set whether to read fields corresponding to `TIFFTag`s not in the allowed `TIFFTagSet`s.

  ### Methods declared in class ImageReadParam

  `canSetSourceRenderSize, getDestination, getDestinationBands, getSourceMaxProgressivePass, getSourceMinProgressivePass, getSourceNumProgressivePasses, getSourceRenderSize, setDestination, setDestinationBands, setSourceProgressivePasses, setSourceRenderSize`
  Modifier and Type
  Method
  Description
  `boolean`
  `canSetSourceRenderSize()`
  Returns `true` if this reader allows the source image to be rendered at an arbitrary size as part of the decoding process, by means of the `setSourceRenderSize` method.
  `BufferedImage`
  `getDestination()`
  Returns the `BufferedImage` currently set by the `setDestination` method, or `null` if none is set.
  `int[]`
  `getDestinationBands()`
  Returns the set of band indices where data will be placed.
  `int`
  `getSourceMaxProgressivePass()`
  If `getSourceNumProgressivePasses` is equal to `Integer.MAX_VALUE`, returns `Integer.MAX_VALUE`.
  `int`
  `getSourceMinProgressivePass()`
  Returns the index of the first progressive pass that will be decoded.
  `int`
  `getSourceNumProgressivePasses()`
  Returns the number of the progressive passes that will be decoded.
  `Dimension`
  `getSourceRenderSize()`
  Returns the width and height of the source image as it will be rendered during decoding, if they have been set via the `setSourceRenderSize` method.
  `void`
  `setDestination(BufferedImage destination)`
  Supplies a `BufferedImage` to be used as the destination for decoded pixel data.
  `void`
  `setDestinationBands(int[] destinationBands)`
  Sets the indices of the destination bands where data will be placed.
  `void`
  `setSourceProgressivePasses(int minPass, int numPasses)`
  Sets the range of progressive passes that will be decoded.
  `void`
  `setSourceRenderSize(Dimension size)`
  If the image is able to be rendered at an arbitrary size, sets the source width and height to the supplied values.

  ### Methods declared in class IIOParam

  `activateController, getController, getDefaultController, getDestinationOffset, getDestinationType, getSourceBands, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset, getSubsamplingYOffset, hasController, setController, setDestinationOffset, setDestinationType, setSourceBands, setSourceRegion, setSourceSubsampling`
  Modifier and Type
  Method
  Description
  `boolean`
  `activateController()`
  Activates the installed `IIOParamController` for this `IIOParam` object and returns the resulting value.
  `IIOParamController`
  `getController()`
  Returns whatever `IIOParamController` is currently installed.
  `IIOParamController`
  `getDefaultController()`
  Returns the default `IIOParamController`, if there is one, regardless of the currently installed controller.
  `Point`
  `getDestinationOffset()`
  Returns the offset in the destination image at which pixels are to be placed.
  `ImageTypeSpecifier`
  `getDestinationType()`
  Returns the type of image to be returned by the read, if one was set by a call to `setDestination(ImageTypeSpecifier)`, as an `ImageTypeSpecifier`.
  `int[]`
  `getSourceBands()`
  Returns the set of source bands to be used.
  `Rectangle`
  `getSourceRegion()`
  Returns the source region to be used.
  `int`
  `getSourceXSubsampling()`
  Returns the number of source columns to advance for each pixel.
  `int`
  `getSourceYSubsampling()`
  Returns the number of rows to advance for each pixel.
  `int`
  `getSubsamplingXOffset()`
  Returns the horizontal offset of the subsampling grid.
  `int`
  `getSubsamplingYOffset()`
  Returns the vertical offset of the subsampling grid.
  `boolean`
  `hasController()`
  Returns `true` if there is a controller installed for this `IIOParam` object.
  `void`
  `setController(IIOParamController controller)`
  Sets the `IIOParamController` to be used to provide settings for this `IIOParam` object when the `activateController` method is called, overriding any default controller.
  `void`
  `setDestinationOffset(Point destinationOffset)`
  Specifies the offset in the destination image at which future decoded pixels are to be placed, when reading, or where a region will be written, when writing.
  `void`
  `setDestinationType(ImageTypeSpecifier destinationType)`
  Sets the desired image type for the destination image, using an `ImageTypeSpecifier`.
  `void`
  `setSourceBands(int[] sourceBands)`
  Sets the indices of the source bands to be used.
  `void`
  `setSourceRegion(Rectangle sourceRegion)`
  Sets the source region of interest.
  `void`
  `setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset)`
  Specifies a decimation subsampling to apply on I/O.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### TIFFImageReadParam

    public TIFFImageReadParam()
    Constructs a `TIFFImageReadParam`. Tags defined by the `TIFFTagSet`s `BaselineTIFFTagSet`, `FaxTIFFTagSet`, `ExifParentTIFFTagSet`, and `GeoTIFFTagSet` will be supported.
    See Also:
      - `BaselineTIFFTagSet`
      - `FaxTIFFTagSet`
      - `ExifParentTIFFTagSet`
      - `GeoTIFFTagSet`

- ## Method Details

  - ### addAllowedTagSet

    public void addAllowedTagSet(TIFFTagSet tagSet)
    Adds a `TIFFTagSet` object to the list of allowed tag sets. Attempting to add a duplicate object to the list has no effect.
    Parameters:
      `tagSet` - a `TIFFTagSet`.
    Throws:
      `IllegalArgumentException` - if `tagSet` is `null`.

  - ### removeAllowedTagSet

    public void removeAllowedTagSet(TIFFTagSet tagSet)
    Removes a `TIFFTagSet` object from the list of allowed tag sets. Removal is based on the `equals` method of the `TIFFTagSet`, which is normally defined as reference equality.
    Parameters:
      `tagSet` - a `TIFFTagSet`.
    Throws:
      `IllegalArgumentException` - if `tagSet` is `null`.

  - ### getAllowedTagSets

    public List<TIFFTagSet> getAllowedTagSets()
    Returns a `List` containing the allowed `TIFFTagSet` objects.
    Returns:
      a `List` of `TIFFTagSet`s.

  - ### setReadUnknownTags

    public void setReadUnknownTags(boolean readUnknownTags)
    Set whether to read fields corresponding to `TIFFTag`s not in the allowed `TIFFTagSet`s. The default setting is `false`. If the TIFF `ImageReader` is ignoring metadata, then a setting of `true` is overridden as all metadata are ignored except those essential to reading the image itself.
    Parameters:
      `readUnknownTags` - Whether to read fields of unrecognized tags

  - ### getReadUnknownTags

    public boolean getReadUnknownTags()
    Retrieve the setting of whether to read fields corresponding to unknown `TIFFTag`s.
    Returns:
      Whether to read fields of unrecognized tags