loci.formats.tiff

## Enum TiffCompression

- java.lang.Object
- - java.lang.Enum<TiffCompression>
  - - loci.formats.tiff.TiffCompression

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<TiffCompression>, loci.common.enumeration.CodedEnum

      public enum TiffCompression
      extends java.lang.Enum<TiffCompression>
      implements loci.common.enumeration.CodedEnum

  Utility class for performing compression operations with a TIFF file.
  Author:
    Curtis Rueden ctrueden at wisc.edu, Eric Kjellman egkjellman at wisc.edu, Melissa Linkert melissa at glencoesoftware.com, Chris Allan callan at blackcat.ca

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ALT_JPEG`
    `ALT_JPEG2000`
    `CCITT_1D`
    `DEFAULT_UNCOMPRESSED`
    `DEFLATE`
    `GROUP_3_FAX`
    `GROUP_4_FAX`
    `JPEG`
    `JPEG_2000`
    `JPEG_2000_LOSSY`
    `JPEGXR`
    `LZW`
    `NIKON`
    `OLD_JPEG`
    `OLYMPUS_JPEG2000`
    `PACK_BITS`
    `PROPRIETARY_DEFLATE`
    `THUNDERSCAN`
    `UNCOMPRESSED`
    `ZSTD`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `code` Code for the TIFF compression in the actual TIFF file.
    `private Codec` | `codec` TIFF compression codec.
    `private java.lang.String` | `codecName` Name of the TIFF compression codec.
    `private static org.slf4j.Logger` | `LOGGER`
    `private static java.util.Map<java.lang.Integer,TiffCompression>` | `lookup` Reverse lookup of code to TIFF compression enumerate value.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `compress(byte[] input, CodecOptions options)` Encodes a strip of data.
    `byte[]` | `decompress(byte[] input, CodecOptions options)` Decodes a strip of data.
    `static void` | `difference(byte[] input, IFD ifd)` Performs in-place differencing according to the given predictor value.
    `static TiffCompression` | `get(int code)` Retrieves a TIFF compression instance by code.
    `int` | `getCode()`
    `Codec` | `getCodec()`
    `java.lang.String` | `getCodecName()` Retrieves the name of the TIFF compression codec.
    `CodecOptions` | `getCompressionCodecOptions(IFD ifd)` Creates a set of codec options for compression.
    `CodecOptions` | `getCompressionCodecOptions(IFD ifd, CodecOptions opt)` Creates a set of codec options for compression.
    `private static java.util.Map<java.lang.Integer,TiffCompression>` | `getCompressionMap()`
    `static void` | `undifference(byte[] input, IFD ifd)` Undoes in-place differencing according to the given predictor value.
    `static TiffCompression` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static TiffCompression[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### DEFAULT_UNCOMPRESSED

          public static final TiffCompression DEFAULT_UNCOMPRESSED

    - #### UNCOMPRESSED

          public static final TiffCompression UNCOMPRESSED

    - #### CCITT_1D

          public static final TiffCompression CCITT_1D

    - #### GROUP_3_FAX

          public static final TiffCompression GROUP_3_FAX

    - #### GROUP_4_FAX

          public static final TiffCompression GROUP_4_FAX

    - #### LZW

          public static final TiffCompression LZW

    - #### OLD_JPEG

          public static final TiffCompression OLD_JPEG

    - #### JPEG

          public static final TiffCompression JPEG

    - #### PACK_BITS

          public static final TiffCompression PACK_BITS

    - #### PROPRIETARY_DEFLATE

          public static final TiffCompression PROPRIETARY_DEFLATE

    - #### DEFLATE

          public static final TiffCompression DEFLATE

    - #### THUNDERSCAN

          public static final TiffCompression THUNDERSCAN

    - #### JPEG_2000

          public static final TiffCompression JPEG_2000

    - #### JPEG_2000_LOSSY

          public static final TiffCompression JPEG_2000_LOSSY

    - #### ALT_JPEG2000

          public static final TiffCompression ALT_JPEG2000

    - #### ALT_JPEG

          public static final TiffCompression ALT_JPEG

    - #### OLYMPUS_JPEG2000

          public static final TiffCompression OLYMPUS_JPEG2000

    - #### NIKON

          public static final TiffCompression NIKON

    - #### JPEGXR

          public static final TiffCompression JPEGXR

    - #### ZSTD

          public static final TiffCompression ZSTD

  - ### Field Detail

    - #### LOGGER

          private static final org.slf4j.Logger LOGGER

    - #### code

          private int code

      Code for the TIFF compression in the actual TIFF file.

    - #### codec

          private Codec codec

      TIFF compression codec.

    - #### codecName

          private java.lang.String codecName

      Name of the TIFF compression codec.

    - #### lookup

          private static final java.util.Map<java.lang.Integer,TiffCompression> lookup

      Reverse lookup of code to TIFF compression enumerate value.

  - ### Method Detail

    - #### values

          public static TiffCompression[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (TiffCompression c : TiffCompression.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static TiffCompression valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null

    - #### getCompressionMap

          private static java.util.Map<java.lang.Integer,TiffCompression> getCompressionMap()

    - #### get

          public static TiffCompression get(int code)

      Retrieves a TIFF compression instance by code.
      Parameters:
        `code` - Integer "code" for the TIFF compression type.
      Returns:
        See above.

    - #### getCode

          public int getCode()

      Specified by:
        `getCode` in interface `loci.common.enumeration.CodedEnum`

    - #### getCodecName

          public java.lang.String getCodecName()

      Retrieves the name of the TIFF compression codec.
      Returns:
        See above.

    - #### getCodec

          public Codec getCodec()

      Returns:
        the codec instance for this TIFF compression.

    - #### decompress

          public byte[] decompress(byte[] input,
                                   CodecOptions options)
                            throws FormatException,
                                   java.io.IOException

      Decodes a strip of data.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### undifference

          public static void undifference(byte[] input,
                                          IFD ifd)
                                   throws FormatException

      Undoes in-place differencing according to the given predictor value.
      Throws:
        `FormatException`

    - #### getCompressionCodecOptions

          public CodecOptions getCompressionCodecOptions(IFD ifd)
                                                  throws FormatException

      Creates a set of codec options for compression.
      Parameters:
        `ifd` - The IFD to create codec options for.
      Returns:
        A new codec options instance populated using metadata from `ifd`.
      Throws:
        `FormatException`

    - #### getCompressionCodecOptions

          public CodecOptions getCompressionCodecOptions(IFD ifd,
                                                         CodecOptions opt)
                                                  throws FormatException

      Creates a set of codec options for compression.
      Parameters:
        `ifd` - The IFD to create codec options for.
        `opt` - The codec options to copy.
      Returns:
        A new codec options instance populated using metadata from `ifd`.
      Throws:
        `FormatException`

    - #### compress

          public byte[] compress(byte[] input,
                                 CodecOptions options)
                          throws FormatException,
                                 java.io.IOException

      Encodes a strip of data.
      Throws:
        `FormatException`
        `java.io.IOException`

    - #### difference

          public static void difference(byte[] input,
                                        IFD ifd)
                                 throws FormatException

      Performs in-place differencing according to the given predictor value.
      Throws:
        `FormatException`

Copyright © 2026 Open Microscopy Environment