org.apache.xmlgraphics.image.codec.tiff

## Class TIFFImageDecoder

- java.lang.Object
- - org.apache.xmlgraphics.image.codec.util.ImageDecoderImpl
  - - org.apache.xmlgraphics.image.codec.tiff.TIFFImageDecoder

- All Implemented Interfaces:
    ImageDecoder

      public class TIFFImageDecoder
      extends ImageDecoderImpl

  A baseline TIFF reader. The reader has some functionality in addition to the baseline specifications for Bilevel images, for which the group 3 and group 4 decompression schemes have been implemented. Support for LZW decompression has also been added. Support for Horizontal differencing predictor decoding is also included, when used with LZW compression. However, this support is limited to data with bitsPerSample value of 8. When reading in RGB images, support for alpha and extraSamples being present has been added. Support for reading in images with 16 bit samples has been added. Support for the SampleFormat tag (signed samples as well as floating-point samples) has also been added. In all other cases, support is limited to Baseline specifications.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `TIFF_BITS_PER_SAMPLE`
    `static int` | `TIFF_COLORMAP`
    `static int` | `TIFF_COMPRESSION`
    `static int` | `TIFF_EXTRA_SAMPLES`
    `static int` | `TIFF_FILL_ORDER`
    `static int` | `TIFF_ICC_PROFILE`
    `static int` | `TIFF_IMAGE_LENGTH`
    `static int` | `TIFF_IMAGE_WIDTH`
    `static int` | `TIFF_PHOTOMETRIC_INTERPRETATION`
    `static int` | `TIFF_PLANAR_CONFIGURATION`
    `static int` | `TIFF_PREDICTOR`
    `static int` | `TIFF_RESOLUTION_UNIT`
    `static int` | `TIFF_ROWS_PER_STRIP`
    `static int` | `TIFF_S_MAX_SAMPLE_VALUE`
    `static int` | `TIFF_S_MIN_SAMPLE_VALUE`
    `static int` | `TIFF_SAMPLE_FORMAT`
    `static int` | `TIFF_SAMPLES_PER_PIXEL`
    `static int` | `TIFF_STRIP_BYTE_COUNTS`
    `static int` | `TIFF_STRIP_OFFSETS`
    `static int` | `TIFF_T4_OPTIONS`
    `static int` | `TIFF_T6_OPTIONS`
    `static int` | `TIFF_TILE_BYTE_COUNTS`
    `static int` | `TIFF_TILE_LENGTH`
    `static int` | `TIFF_TILE_OFFSETS`
    `static int` | `TIFF_TILE_WIDTH`
    `static int` | `TIFF_X_RESOLUTION`
    `static int` | `TIFF_Y_RESOLUTION`

    - ### Fields inherited from class org.apache.xmlgraphics.image.codec.util.ImageDecoderImpl

      `input, param`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TIFFImageDecoder(SeekableStream input, TIFFDecodeParam param)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.awt.image.RenderedImage` | `decodeAsRenderedImage(int page)` Returns a `RenderedImage` that contains the decoded contents of the `SeekableStream` associated with this `ImageDecoder`.
    `int` | `getNumPages()` Returns the number of pages present in the current stream.

    - ### Methods inherited from class org.apache.xmlgraphics.image.codec.util.ImageDecoderImpl

      `decodeAsRaster, decodeAsRaster, decodeAsRenderedImage, getInputStream, getParam, setParam`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TIFF_IMAGE_WIDTH

          public static final int TIFF_IMAGE_WIDTH

      See Also:
        Constant Field Values

    - #### TIFF_IMAGE_LENGTH

          public static final int TIFF_IMAGE_LENGTH

      See Also:
        Constant Field Values

    - #### TIFF_BITS_PER_SAMPLE

          public static final int TIFF_BITS_PER_SAMPLE

      See Also:
        Constant Field Values

    - #### TIFF_COMPRESSION

          public static final int TIFF_COMPRESSION

      See Also:
        Constant Field Values

    - #### TIFF_PHOTOMETRIC_INTERPRETATION

          public static final int TIFF_PHOTOMETRIC_INTERPRETATION

      See Also:
        Constant Field Values

    - #### TIFF_FILL_ORDER

          public static final int TIFF_FILL_ORDER

      See Also:
        Constant Field Values

    - #### TIFF_STRIP_OFFSETS

          public static final int TIFF_STRIP_OFFSETS

      See Also:
        Constant Field Values

    - #### TIFF_SAMPLES_PER_PIXEL

          public static final int TIFF_SAMPLES_PER_PIXEL

      See Also:
        Constant Field Values

    - #### TIFF_ROWS_PER_STRIP

          public static final int TIFF_ROWS_PER_STRIP

      See Also:
        Constant Field Values

    - #### TIFF_STRIP_BYTE_COUNTS

          public static final int TIFF_STRIP_BYTE_COUNTS

      See Also:
        Constant Field Values

    - #### TIFF_X_RESOLUTION

          public static final int TIFF_X_RESOLUTION

      See Also:
        Constant Field Values

    - #### TIFF_Y_RESOLUTION

          public static final int TIFF_Y_RESOLUTION

      See Also:
        Constant Field Values

    - #### TIFF_PLANAR_CONFIGURATION

          public static final int TIFF_PLANAR_CONFIGURATION

      See Also:
        Constant Field Values

    - #### TIFF_T4_OPTIONS

          public static final int TIFF_T4_OPTIONS

      See Also:
        Constant Field Values

    - #### TIFF_T6_OPTIONS

          public static final int TIFF_T6_OPTIONS

      See Also:
        Constant Field Values

    - #### TIFF_RESOLUTION_UNIT

          public static final int TIFF_RESOLUTION_UNIT

      See Also:
        Constant Field Values

    - #### TIFF_PREDICTOR

          public static final int TIFF_PREDICTOR

      See Also:
        Constant Field Values

    - #### TIFF_COLORMAP

          public static final int TIFF_COLORMAP

      See Also:
        Constant Field Values

    - #### TIFF_TILE_WIDTH

          public static final int TIFF_TILE_WIDTH

      See Also:
        Constant Field Values

    - #### TIFF_TILE_LENGTH

          public static final int TIFF_TILE_LENGTH

      See Also:
        Constant Field Values

    - #### TIFF_TILE_OFFSETS

          public static final int TIFF_TILE_OFFSETS

      See Also:
        Constant Field Values

    - #### TIFF_TILE_BYTE_COUNTS

          public static final int TIFF_TILE_BYTE_COUNTS

      See Also:
        Constant Field Values

    - #### TIFF_EXTRA_SAMPLES

          public static final int TIFF_EXTRA_SAMPLES

      See Also:
        Constant Field Values

    - #### TIFF_SAMPLE_FORMAT

          public static final int TIFF_SAMPLE_FORMAT

      See Also:
        Constant Field Values

    - #### TIFF_S_MIN_SAMPLE_VALUE

          public static final int TIFF_S_MIN_SAMPLE_VALUE

      See Also:
        Constant Field Values

    - #### TIFF_S_MAX_SAMPLE_VALUE

          public static final int TIFF_S_MAX_SAMPLE_VALUE

      See Also:
        Constant Field Values

    - #### TIFF_ICC_PROFILE

          public static final int TIFF_ICC_PROFILE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TIFFImageDecoder

          public TIFFImageDecoder(SeekableStream input,
                                  TIFFDecodeParam param)

  - ### Method Detail

    - #### getNumPages

          public int getNumPages()
                          throws java.io.IOException

      Description copied from class: `ImageDecoderImpl`
      Returns the number of pages present in the current stream. By default, the return value is 1. Subclasses that deal with multi-page formats should override this method.
      Specified by:
        `getNumPages` in interface `ImageDecoder`
      Overrides:
        `getNumPages` in class `ImageDecoderImpl`
      Throws:
        `java.io.IOException`

    - #### decodeAsRenderedImage

          public java.awt.image.RenderedImage decodeAsRenderedImage(int page)
                                                             throws java.io.IOException

      Description copied from class: `ImageDecoderImpl`
      Returns a `RenderedImage` that contains the decoded contents of the `SeekableStream` associated with this `ImageDecoder`. The given page of a multi-page image is decoded. If the page does not exist, an IOException will be thrown. Page numbering begins at zero.
      Specified by:
        `decodeAsRenderedImage` in interface `ImageDecoder`
      Specified by:
        `decodeAsRenderedImage` in class `ImageDecoderImpl`
      Parameters:
        `page` - The page to be decoded.
      Throws:
        `java.io.IOException`

Copyright 1999-2025 The Apache Software Foundation. All Rights Reserved.