从Python PIL incorrectly decoding TIFF colors (using incorrect colorspace)?开始,我推断通过设置PIL.Image.DEBUG = True
,以前可以让PIL转储一堆有用的调试输出。但是,此属性不再存在;每https://github.com/python-pillow/Pillow/issues/1191,看起来几年前它被内置日志记录模块的使用所取代。
然而,如果我这样做
import logging
logging.root.setLevel(logging.DEBUG)
logging.debug('Test') # Trigger installation of default StreamHandler
from PIL import Image
Image.open('my_picture.tif').show()
然后除了'Test'消息之外我没有记录输出。
从Pillow查看调试日志记录需要做什么?
答案 0 :(得分:1)
要获取您感兴趣的TIFF输出-
from PIL import Image, TiffImagePlugin
TiffImagePlugin.DEBUG = True
Image.open('my_picture.tif')