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

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


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 {
} 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:

I can participate in work on implementation if these interface changes will be approved.

Best regards,

Vladimir Pastukhov