loci.formats
Class TiffTools

java.lang.Object
  extended byloci.formats.TiffTools

public abstract class TiffTools
extends Object

A utility class for manipulating TIFF files.


Field Summary
static int ARTIST
           
static int ASCII
           
static int BIG
           
static int BITS_PER_SAMPLE
           
static int BLACK_IS_ZERO
           
static int BYTE
           
static int CCITT_1D
           
static int CELL_LENGTH
           
static int CELL_WIDTH
           
static int CIE_LAB
           
static int CMYK
           
static int COLOR_MAP
           
static int COMPRESSION
           
static int COPYRIGHT
           
static int DATE_TIME
           
static boolean DEBUG
           
static int DEFLATE
           
static int DOCUMENT_NAME
           
static int DOT_RANGE
           
static int DOUBLE
           
static int EXTRA_SAMPLES
           
static int FILL_ORDER
           
static int FLOAT
           
static int FREE_BYTE_COUNTS
           
static int FREE_OFFSETS
           
static int GRAY_RESPONSE_CURVE
           
static int GRAY_RESPONSE_UNIT
           
static int GROUP_3_FAX
           
static int GROUP_4_FAX
           
static int HALFTONE_HINTS
           
static int HOST_COMPUTER
           
static int IMAGE_DESCRIPTION
           
static int IMAGE_LENGTH
           
static int IMAGE_WIDTH
           
static int INK_NAMES
           
static int INK_SET
           
static int JPEG
           
static int JPEG_AC_TABLES
           
static int JPEG_DC_TABLES
           
static int JPEG_INTERCHANGE_FORMAT
           
static int JPEG_INTERCHANGE_FORMAT_LENGTH
           
static int JPEG_LOSSLESS_PREDICTORS
           
static int JPEG_POINT_TRANSFORMS
           
static int JPEG_PROC
           
static int JPEG_Q_TABLES
           
static int JPEG_RESTART_INTERVAL
           
static int LITTLE
           
static int LITTLE_ENDIAN
           
static int LONG
           
static int LZW
           
static int MAGIC_NUMBER
           
static int MAKE
           
static int MAX_SAMPLE_VALUE
           
static int MIN_SAMPLE_VALUE
           
static int MODEL
           
static int NEW_SUBFILE_TYPE
           
static int NUMBER_OF_INKS
           
static int ORIENTATION
           
static int PACK_BITS
           
static int PAGE_NAME
           
static int PAGE_NUMBER
           
static int PHOTOMETRIC_INTERPRETATION
           
static int PLANAR_CONFIGURATION
           
static int PREDICTOR
           
static int PRIMARY_CHROMATICITIES
           
static int PROPRIETARY_DEFLATE
           
static int RATIONAL
           
static int REFERENCE_BLACK_WHITE
           
static int RESOLUTION_UNIT
           
static int RGB
           
static int RGB_PALETTE
           
static int ROWS_PER_STRIP
           
static int S_MAX_SAMPLE_VALUE
           
static int S_MIN_SAMPLE_VALUE
           
static int SAMPLE_FORMAT
           
static int SAMPLES_PER_PIXEL
           
static int SBYTE
           
static int SHORT
           
static int SLONG
           
static int SOFTWARE
           
static int SRATIONAL
           
static int SSHORT
           
static int STRIP_BYTE_COUNTS
           
static int STRIP_OFFSETS
           
static int SUBFILE_TYPE
           
static int T4_OPTIONS
           
static int T6_OPTIONS
           
static int TARGET_PRINTER
           
static int THRESHHOLDING
           
static int THUNDERSCAN
           
static int TILE_BYTE_COUNTS
           
static int TILE_LENGTH
           
static int TILE_OFFSETS
           
static int TILE_WIDTH
           
static int TRANSFER_FUNCTION
           
static int TRANSFER_RANGE
           
static int TRANSPARENCY_MASK
           
static int UNCOMPRESSED
           
static int UNDEFINED
           
static int WHITE_IS_ZERO
           
static int WHITE_POINT
           
static int X_POSITION
           
static int X_RESOLUTION
           
static int Y_CB_CR
           
static int Y_CB_CR_COEFFICIENTS
           
static int Y_CB_CR_POSITIONING
           
static int Y_CB_CR_SUB_SAMPLING
           
static int Y_POSITION
           
static int Y_RESOLUTION
           
 
Constructor Summary
TiffTools()
           
 
Method Summary
static byte[] compress(byte[] input, int compression)
          Encodes a strip of data with the given compression scheme.
static void debug(String message)
          Prints a debugging message with current time.
static void difference(byte[] input, int[] bitsPerSample, long width, int planarConfig, int predictor)
          Performs in-place differencing according to the given predictor value.
static int[] getIFDIntArray(Hashtable ifd, int tag, boolean checkNull)
          Gets the given directory entry values in int format from the specified IFD, performing some error checking.
static int getIFDIntValue(Hashtable ifd, int tag)
          Gets the given directory entry value in int format from the specified IFD, or -1 if the given directory does not exist.
static int getIFDIntValue(Hashtable ifd, int tag, boolean checkNull, int defaultValue)
          Gets the given directory entry value in int format from the specified IFD, performing some error checking.
static long[] getIFDLongArray(Hashtable ifd, int tag, boolean checkNull)
          Gets the given directory entry values in long format from the specified IFD, performing some error checking.
static long getIFDLongValue(Hashtable ifd, int tag, boolean checkNull, long defaultValue)
          Gets the given directory entry value in long format from the specified IFD, performing some error checking.
static TiffRational getIFDRationalValue(Hashtable ifd, int tag, boolean checkNull)
          Gets the given directory entry value in rational format from the specified IFD, performing some error checking.
static Hashtable[] getIFDs(RandomAccessFile in)
          Gets all IFDs within the given TIFF file, or null if the given file is not a valid TIFF file.
static Hashtable[] getIFDs(RandomAccessFile in, int globalOffset)
          Gets all IFDs within the given TIFF file, or null if the given file is not a valid TIFF file.
static short[] getIFDShortArray(Hashtable ifd, int tag, boolean checkNull)
          Gets the given directory entry values in short format from the specified IFD, performing some error checking.
static String getIFDTagName(int tag)
          Gets the name of the IFD tag encoded by the given number.
static Object getIFDValue(Hashtable ifd, int tag)
          Gets the given directory entry value from the specified IFD.
static Object getIFDValue(Hashtable ifd, int tag, boolean checkNull, Class checkClass)
          Gets the given directory entry value from the specified IFD, performing some error checking.
static BufferedImage getImage(Hashtable ifd, RandomAccessFile in)
          Reads the image defined in the given IFD from the specified file.
static BufferedImage getImage(Hashtable ifd, RandomAccessFile in, int globalOffset)
          Reads the image defined in the given IFD from the specified file.
static boolean isLittleEndian(Hashtable ifd)
          Gets whether the TIFF information in the given IFD is little endian.
static boolean isValidHeader(byte[] block)
          Tests the given data block to see if it represents the first few bytes of a TIFF file.
static void planarUnpack(short[][] samples, int startIndex, byte[] bytes, int[] bitsPerSample, int photoInterp, boolean littleEndian, int strip, int numStrips)
          Extracts pixel information from the given byte array according to the bits per sample, photometric interpretation, and the specified byte ordering.
static void putIFDValue(Hashtable ifd, int tag, int value)
          Adds a directory entry of type SHORT to an IFD.
static void putIFDValue(Hashtable ifd, int tag, long value)
          Adds a directory entry of type LONG to an IFD.
static void putIFDValue(Hashtable ifd, int tag, Object value)
          Adds a directory entry to an IFD.
static void putIFDValue(Hashtable ifd, int tag, short value)
          Adds a directory entry of type BYTE to an IFD.
static byte[] uncompress(byte[] input, int compression)
          Decodes a strip of data compressed with the given compression scheme.
static void undifference(byte[] input, int[] bitsPerSample, long width, int planarConfig, int predictor)
          Undoes in-place differencing according to the given predictor value.
static void unpackBytes(short[][] samples, int startIndex, byte[] bytes, int[] bitsPerSample, int photoInterp, int[] colorMap, boolean littleEndian, long maxValue, int planar, int strip, int numStrips)
          Extracts pixel information from the given byte array according to the bits per sample, photometric interpretation and color map IFD directory entry values, and the specified byte ordering.
static long writeImage(Image image, Hashtable ifd, OutputStream out, int offset, boolean last)
          Writes the given field to the specified output stream using the given byte offset and IFD, in big-endian format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

LITTLE_ENDIAN

public static final int LITTLE_ENDIAN
See Also:
Constant Field Values

NEW_SUBFILE_TYPE

public static final int NEW_SUBFILE_TYPE
See Also:
Constant Field Values

SUBFILE_TYPE

public static final int SUBFILE_TYPE
See Also:
Constant Field Values

IMAGE_WIDTH

public static final int IMAGE_WIDTH
See Also:
Constant Field Values

IMAGE_LENGTH

public static final int IMAGE_LENGTH
See Also:
Constant Field Values

BITS_PER_SAMPLE

public static final int BITS_PER_SAMPLE
See Also:
Constant Field Values

COMPRESSION

public static final int COMPRESSION
See Also:
Constant Field Values

PHOTOMETRIC_INTERPRETATION

public static final int PHOTOMETRIC_INTERPRETATION
See Also:
Constant Field Values

THRESHHOLDING

public static final int THRESHHOLDING
See Also:
Constant Field Values

CELL_WIDTH

public static final int CELL_WIDTH
See Also:
Constant Field Values

CELL_LENGTH

public static final int CELL_LENGTH
See Also:
Constant Field Values

FILL_ORDER

public static final int FILL_ORDER
See Also:
Constant Field Values

DOCUMENT_NAME

public static final int DOCUMENT_NAME
See Also:
Constant Field Values

IMAGE_DESCRIPTION

public static final int IMAGE_DESCRIPTION
See Also:
Constant Field Values

MAKE

public static final int MAKE
See Also:
Constant Field Values

MODEL

public static final int MODEL
See Also:
Constant Field Values

STRIP_OFFSETS

public static final int STRIP_OFFSETS
See Also:
Constant Field Values

ORIENTATION

public static final int ORIENTATION
See Also:
Constant Field Values

SAMPLES_PER_PIXEL

public static final int SAMPLES_PER_PIXEL
See Also:
Constant Field Values

ROWS_PER_STRIP

public static final int ROWS_PER_STRIP
See Also:
Constant Field Values

STRIP_BYTE_COUNTS

public static final int STRIP_BYTE_COUNTS
See Also:
Constant Field Values

MIN_SAMPLE_VALUE

public static final int MIN_SAMPLE_VALUE
See Also:
Constant Field Values

MAX_SAMPLE_VALUE

public static final int MAX_SAMPLE_VALUE
See Also:
Constant Field Values

X_RESOLUTION

public static final int X_RESOLUTION
See Also:
Constant Field Values

Y_RESOLUTION

public static final int Y_RESOLUTION
See Also:
Constant Field Values

PLANAR_CONFIGURATION

public static final int PLANAR_CONFIGURATION
See Also:
Constant Field Values

PAGE_NAME

public static final int PAGE_NAME
See Also:
Constant Field Values

X_POSITION

public static final int X_POSITION
See Also:
Constant Field Values

Y_POSITION

public static final int Y_POSITION
See Also:
Constant Field Values

FREE_OFFSETS

public static final int FREE_OFFSETS
See Also:
Constant Field Values

FREE_BYTE_COUNTS

public static final int FREE_BYTE_COUNTS
See Also:
Constant Field Values

GRAY_RESPONSE_UNIT

public static final int GRAY_RESPONSE_UNIT
See Also:
Constant Field Values

GRAY_RESPONSE_CURVE

public static final int GRAY_RESPONSE_CURVE
See Also:
Constant Field Values

T4_OPTIONS

public static final int T4_OPTIONS
See Also:
Constant Field Values

T6_OPTIONS

public static final int T6_OPTIONS
See Also:
Constant Field Values

RESOLUTION_UNIT

public static final int RESOLUTION_UNIT
See Also:
Constant Field Values

PAGE_NUMBER

public static final int PAGE_NUMBER
See Also:
Constant Field Values

TRANSFER_FUNCTION

public static final int TRANSFER_FUNCTION
See Also:
Constant Field Values

SOFTWARE

public static final int SOFTWARE
See Also:
Constant Field Values

DATE_TIME

public static final int DATE_TIME
See Also:
Constant Field Values

ARTIST

public static final int ARTIST
See Also:
Constant Field Values

HOST_COMPUTER

public static final int HOST_COMPUTER
See Also:
Constant Field Values

PREDICTOR

public static final int PREDICTOR
See Also:
Constant Field Values

WHITE_POINT

public static final int WHITE_POINT
See Also:
Constant Field Values

PRIMARY_CHROMATICITIES

public static final int PRIMARY_CHROMATICITIES
See Also:
Constant Field Values

COLOR_MAP

public static final int COLOR_MAP
See Also:
Constant Field Values

HALFTONE_HINTS

public static final int HALFTONE_HINTS
See Also:
Constant Field Values

TILE_WIDTH

public static final int TILE_WIDTH
See Also:
Constant Field Values

TILE_LENGTH

public static final int TILE_LENGTH
See Also:
Constant Field Values

TILE_OFFSETS

public static final int TILE_OFFSETS
See Also:
Constant Field Values

TILE_BYTE_COUNTS

public static final int TILE_BYTE_COUNTS
See Also:
Constant Field Values

INK_SET

public static final int INK_SET
See Also:
Constant Field Values

INK_NAMES

public static final int INK_NAMES
See Also:
Constant Field Values

NUMBER_OF_INKS

public static final int NUMBER_OF_INKS
See Also:
Constant Field Values

DOT_RANGE

public static final int DOT_RANGE
See Also:
Constant Field Values

TARGET_PRINTER

public static final int TARGET_PRINTER
See Also:
Constant Field Values

EXTRA_SAMPLES

public static final int EXTRA_SAMPLES
See Also:
Constant Field Values

SAMPLE_FORMAT

public static final int SAMPLE_FORMAT
See Also:
Constant Field Values

S_MIN_SAMPLE_VALUE

public static final int S_MIN_SAMPLE_VALUE
See Also:
Constant Field Values

S_MAX_SAMPLE_VALUE

public static final int S_MAX_SAMPLE_VALUE
See Also:
Constant Field Values

TRANSFER_RANGE

public static final int TRANSFER_RANGE
See Also:
Constant Field Values

JPEG_PROC

public static final int JPEG_PROC
See Also:
Constant Field Values

JPEG_INTERCHANGE_FORMAT

public static final int JPEG_INTERCHANGE_FORMAT
See Also:
Constant Field Values

JPEG_INTERCHANGE_FORMAT_LENGTH

public static final int JPEG_INTERCHANGE_FORMAT_LENGTH
See Also:
Constant Field Values

JPEG_RESTART_INTERVAL

public static final int JPEG_RESTART_INTERVAL
See Also:
Constant Field Values

JPEG_LOSSLESS_PREDICTORS

public static final int JPEG_LOSSLESS_PREDICTORS
See Also:
Constant Field Values

JPEG_POINT_TRANSFORMS

public static final int JPEG_POINT_TRANSFORMS
See Also:
Constant Field Values

JPEG_Q_TABLES

public static final int JPEG_Q_TABLES
See Also:
Constant Field Values

JPEG_DC_TABLES

public static final int JPEG_DC_TABLES
See Also:
Constant Field Values

JPEG_AC_TABLES

public static final int JPEG_AC_TABLES
See Also:
Constant Field Values

Y_CB_CR_COEFFICIENTS

public static final int Y_CB_CR_COEFFICIENTS
See Also:
Constant Field Values

Y_CB_CR_SUB_SAMPLING

public static final int Y_CB_CR_SUB_SAMPLING
See Also:
Constant Field Values

Y_CB_CR_POSITIONING

public static final int Y_CB_CR_POSITIONING
See Also:
Constant Field Values

REFERENCE_BLACK_WHITE

public static final int REFERENCE_BLACK_WHITE
See Also:
Constant Field Values

COPYRIGHT

public static final int COPYRIGHT
See Also:
Constant Field Values

UNCOMPRESSED

public static final int UNCOMPRESSED
See Also:
Constant Field Values

CCITT_1D

public static final int CCITT_1D
See Also:
Constant Field Values

GROUP_3_FAX

public static final int GROUP_3_FAX
See Also:
Constant Field Values

GROUP_4_FAX

public static final int GROUP_4_FAX
See Also:
Constant Field Values

LZW

public static final int LZW
See Also:
Constant Field Values

JPEG

public static final int JPEG
See Also:
Constant Field Values

PACK_BITS

public static final int PACK_BITS
See Also:
Constant Field Values

PROPRIETARY_DEFLATE

public static final int PROPRIETARY_DEFLATE
See Also:
Constant Field Values

DEFLATE

public static final int DEFLATE
See Also:
Constant Field Values

THUNDERSCAN

public static final int THUNDERSCAN
See Also:
Constant Field Values

WHITE_IS_ZERO

public static final int WHITE_IS_ZERO
See Also:
Constant Field Values

BLACK_IS_ZERO

public static final int BLACK_IS_ZERO
See Also:
Constant Field Values

RGB

public static final int RGB
See Also:
Constant Field Values

RGB_PALETTE

public static final int RGB_PALETTE
See Also:
Constant Field Values

TRANSPARENCY_MASK

public static final int TRANSPARENCY_MASK
See Also:
Constant Field Values

CMYK

public static final int CMYK
See Also:
Constant Field Values

Y_CB_CR

public static final int Y_CB_CR
See Also:
Constant Field Values

CIE_LAB

public static final int CIE_LAB
See Also:
Constant Field Values

BYTE

public static final int BYTE
See Also:
Constant Field Values

ASCII

public static final int ASCII
See Also:
Constant Field Values

SHORT

public static final int SHORT
See Also:
Constant Field Values

LONG

public static final int LONG
See Also:
Constant Field Values

RATIONAL

public static final int RATIONAL
See Also:
Constant Field Values

SBYTE

public static final int SBYTE
See Also:
Constant Field Values

UNDEFINED

public static final int UNDEFINED
See Also:
Constant Field Values

SSHORT

public static final int SSHORT
See Also:
Constant Field Values

SLONG

public static final int SLONG
See Also:
Constant Field Values

SRATIONAL

public static final int SRATIONAL
See Also:
Constant Field Values

FLOAT

public static final int FLOAT
See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
See Also:
Constant Field Values

MAGIC_NUMBER

public static final int MAGIC_NUMBER
See Also:
Constant Field Values

LITTLE

public static final int LITTLE
See Also:
Constant Field Values

BIG

public static final int BIG
See Also:
Constant Field Values
Constructor Detail

TiffTools

public TiffTools()
Method Detail

isValidHeader

public static boolean isValidHeader(byte[] block)
Tests the given data block to see if it represents the first few bytes of a TIFF file.


isLittleEndian

public static boolean isLittleEndian(Hashtable ifd)
                              throws FormatException
Gets whether the TIFF information in the given IFD is little endian.

Throws:
FormatException

getIFDs

public static Hashtable[] getIFDs(RandomAccessFile in)
                           throws IOException
Gets all IFDs within the given TIFF file, or null if the given file is not a valid TIFF file.

Throws:
IOException

getIFDs

public static Hashtable[] getIFDs(RandomAccessFile in,
                                  int globalOffset)
                           throws IOException
Gets all IFDs within the given TIFF file, or null if the given file is not a valid TIFF file.

Throws:
IOException

getIFDTagName

public static String getIFDTagName(int tag)
Gets the name of the IFD tag encoded by the given number.


getIFDValue

public static Object getIFDValue(Hashtable ifd,
                                 int tag)
Gets the given directory entry value from the specified IFD.


getIFDValue

public static Object getIFDValue(Hashtable ifd,
                                 int tag,
                                 boolean checkNull,
                                 Class checkClass)
                          throws FormatException
Gets the given directory entry value from the specified IFD, performing some error checking.

Throws:
FormatException

getIFDLongValue

public static long getIFDLongValue(Hashtable ifd,
                                   int tag,
                                   boolean checkNull,
                                   long defaultValue)
                            throws FormatException
Gets the given directory entry value in long format from the specified IFD, performing some error checking.

Throws:
FormatException

getIFDIntValue

public static int getIFDIntValue(Hashtable ifd,
                                 int tag)
Gets the given directory entry value in int format from the specified IFD, or -1 if the given directory does not exist.


getIFDIntValue

public static int getIFDIntValue(Hashtable ifd,
                                 int tag,
                                 boolean checkNull,
                                 int defaultValue)
                          throws FormatException
Gets the given directory entry value in int format from the specified IFD, performing some error checking.

Throws:
FormatException

getIFDRationalValue

public static TiffRational getIFDRationalValue(Hashtable ifd,
                                               int tag,
                                               boolean checkNull)
                                        throws FormatException
Gets the given directory entry value in rational format from the specified IFD, performing some error checking.

Throws:
FormatException

getIFDLongArray

public static long[] getIFDLongArray(Hashtable ifd,
                                     int tag,
                                     boolean checkNull)
                              throws FormatException
Gets the given directory entry values in long format from the specified IFD, performing some error checking.

Throws:
FormatException

getIFDIntArray

public static int[] getIFDIntArray(Hashtable ifd,
                                   int tag,
                                   boolean checkNull)
                            throws FormatException
Gets the given directory entry values in int format from the specified IFD, performing some error checking.

Throws:
FormatException

getIFDShortArray

public static short[] getIFDShortArray(Hashtable ifd,
                                       int tag,
                                       boolean checkNull)
                                throws FormatException
Gets the given directory entry values in short format from the specified IFD, performing some error checking.

Throws:
FormatException

getImage

public static BufferedImage getImage(Hashtable ifd,
                                     RandomAccessFile in)
                              throws FormatException,
                                     IOException
Reads the image defined in the given IFD from the specified file.

Throws:
FormatException
IOException

getImage

public static BufferedImage getImage(Hashtable ifd,
                                     RandomAccessFile in,
                                     int globalOffset)
                              throws FormatException,
                                     IOException
Reads the image defined in the given IFD from the specified file.

Throws:
FormatException
IOException

planarUnpack

public static void planarUnpack(short[][] samples,
                                int startIndex,
                                byte[] bytes,
                                int[] bitsPerSample,
                                int photoInterp,
                                boolean littleEndian,
                                int strip,
                                int numStrips)
                         throws FormatException
Extracts pixel information from the given byte array according to the bits per sample, photometric interpretation, and the specified byte ordering. No error checking is performed. This method is tailored specifically for planar (separated) images.

Throws:
FormatException

unpackBytes

public static void unpackBytes(short[][] samples,
                               int startIndex,
                               byte[] bytes,
                               int[] bitsPerSample,
                               int photoInterp,
                               int[] colorMap,
                               boolean littleEndian,
                               long maxValue,
                               int planar,
                               int strip,
                               int numStrips)
                        throws FormatException
Extracts pixel information from the given byte array according to the bits per sample, photometric interpretation and color map IFD directory entry values, and the specified byte ordering. No error checking is performed.

Throws:
FormatException

uncompress

public static byte[] uncompress(byte[] input,
                                int compression)
                         throws FormatException,
                                IOException
Decodes a strip of data compressed with the given compression scheme.

Throws:
FormatException
IOException

undifference

public static void undifference(byte[] input,
                                int[] bitsPerSample,
                                long width,
                                int planarConfig,
                                int predictor)
                         throws FormatException
Undoes in-place differencing according to the given predictor value.

Throws:
FormatException

putIFDValue

public static void putIFDValue(Hashtable ifd,
                               int tag,
                               Object value)
Adds a directory entry to an IFD.


putIFDValue

public static void putIFDValue(Hashtable ifd,
                               int tag,
                               short value)
Adds a directory entry of type BYTE to an IFD.


putIFDValue

public static void putIFDValue(Hashtable ifd,
                               int tag,
                               int value)
Adds a directory entry of type SHORT to an IFD.


putIFDValue

public static void putIFDValue(Hashtable ifd,
                               int tag,
                               long value)
Adds a directory entry of type LONG to an IFD.


writeImage

public static long writeImage(Image image,
                              Hashtable ifd,
                              OutputStream out,
                              int offset,
                              boolean last)
                       throws FormatException,
                              IOException
Writes the given field to the specified output stream using the given byte offset and IFD, in big-endian format.

Parameters:
image - The field to write
ifd - Hashtable representing the TIFF IFD; can be null
out - The output stream to which the TIFF data should be written
offset - The value to use for specifying byte offsets
last - Whether this image is the final IFD entry of the TIFF data
Returns:
total number of bytes written
Throws:
FormatException
IOException

compress

public static byte[] compress(byte[] input,
                              int compression)
                       throws FormatException,
                              IOException
Encodes a strip of data with the given compression scheme.

Throws:
FormatException
IOException

difference

public static void difference(byte[] input,
                              int[] bitsPerSample,
                              long width,
                              int planarConfig,
                              int predictor)
                       throws FormatException
Performs in-place differencing according to the given predictor value.

Throws:
FormatException

debug

public static void debug(String message)
Prints a debugging message with current time.