Using TIFF G4 image in PIL

杀马特。学长 韩版系。学妹 提交于 2019-12-02 08:00:42

问题


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?


回答1:


It appears that TiffImagePlugin does not easily allow me to hook in additional decompressors. Replacing TiffImageFile._decoder with 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 of tifffile.py for 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.



来源:https://stackoverflow.com/questions/11868963/using-tiff-g4-image-in-pil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!