AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.02.23 12:55 "[Tiff] Request for new functions", by Vladimir Pastukhov
2004.02.23 14:50 "Re: [Tiff] Request for new functions", by Frank Warmerdam
2004.02.24 00:28 "Re: [Tiff] Request for new functions", by Vladimir Pastukhov
2004.02.24 07:28 "Re: [Tiff] Request for new functions", by Andrey Kiselev
2004.02.24 07:30 "Re: [Tiff] Request for new functions", by Andrey Kiselev

2004.02.23 12:55 "[Tiff] Request for new functions", by Vladimir Pastukhov

Hello,

I'm adding Group3 and Group4 TIFF compression support to Python Imaging Library, using Libtiff codecs.

Currently in my solution I have to manipulate internal Libtiff structures, which is a bad programming design. To overcome this problem I want to have several additions to Libtiff interface.

Because PIL can read image in chunks, calling appropriate decoder, it is necessary to save and restore TIFF codec's state. Two new functions are needed. They should have an argument specifying which part of the state structure to copy (all/base/decoder/encoder, decoder and encoder do not include base).

The proposed declarations are:

typedef enum {
     STATE_ALL, STATE_BASE,
     STATE_DECODER, STATE_ENCODER
} TIFFCodecStateType;

tdata_t TIFFSaveCodecState(TIFF *tif, tdata_t buf, TIFFCodecStateType st); void TIFFRestoreCodecState(TIFF *tif, tdata_t buf, TIFFCodecStateType st);

Because allocating memory every time the state is saved seems inefficient, save function should take a pointer to the existing memory buffer. If the pointer is null, it allocates a new buffer and returns its address.

Other less important things I wish to be added:

Best regards,
--
Vladimir Pastukhov
vpastukhov@naumen.ru