I wrote a pure python TIFF G4 decompress for use with tifffile.py. I know there are ways to add libtiff to a custom PIL, but I never could get that working very well in a mixed virtualenv. I want to manipulate the image in PIL. I am looking for pointers in hooking my decompressor to stock PIL for TiffImagePlugin.py.
Any ideas?
It appears that
TiffImagePlugindoes not easily allow me to hook in additional decompressors. ReplacingTiffImageFile._decoderwith a dictionary of decoders might work, but you would have to examine and test each release of PIL to ensure it hasn’t broken. This level of maintenance is just as bad as a custom PIL. I appreciate the design oftifffile.pyfor using a dictionary of decoders. It made it very easy.Final solution? I couldn’t hook my code into PIL. I had to use
PIL.Image.fromarray()to using my decompressed images.