2005.03.22 18:45 "[Tiff] Interface to query compression/subformat parameters", by Bob Friesenhahn

2005.03.22 18:58 "Re: [Tiff] Interface to query compression/subformat parameters", by Frank Warmerdam

Libtiff does not appear to provide a way by which the dependent application may determine the supported TIFF encoding formats, parameters supported by those encoding formats. It also does not appear to provide a way to determine the available compression options. For example, I don't see a way to see if LZW compression is supported by libtiff.

The ability to query for this information should be added so that libtiff becomes easier to use in open-source environments where the author of the dependent application is not also responsible for providing libtiff.


In the not to distant past (perhaps last spring?) Andrey added the TIFFGetConfiguredCODECS() function to get a list of available codecs. It doesn't give details of how those codecs are configured of course. Does it do what you need? I use it like this when I try to describe to the user what codecs are enabled:

        strcpy( szOptionalCompressItems,
                "       <Value>NONE</Value>" );

#if TIFFLIB_VERSION <= 20040919
        strcat( szOptionalCompressItems,
                "       <Value>PACKBITS</Value>"
                "       <Value>JPEG</Value>"
                "       <Value>LZW</Value>"
                "       <Value>DEFLATE</Value>" );
        TIFFCodec       *c, *codecs = TIFFGetConfiguredCODECs();

        for( c = codecs; c->name; c++ )
            if( c->scheme == COMPRESSION_PACKBITS )
                strcat( szOptionalCompressItems,
                        "       <Value>PACKBITS</Value>" );
            else if( c->scheme == COMPRESSION_JPEG )
                strcat( szOptionalCompressItems,
                        "       <Value>JPEG</Value>" );
            else if( c->scheme == COMPRESSION_LZW )
                strcat( szOptionalCompressItems,
                        "       <Value>LZW</Value>" );
            else if( c->scheme == COMPRESSION_ADOBE_DEFLATE )
                strcat( szOptionalCompressItems,
                        "       <Value>DEFLATE</Value>" );
        _TIFFfree( codecs );

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent