来自 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()
除了我的“测试”消息之外,我没有得到任何日志输出。
我需要做什么才能看到 Pillow 的调试日志?
请您参考如下方法:
获取您感兴趣的 TIFF 输出 -
from PIL import Image, TiffImagePlugin
TiffImagePlugin.DEBUG = True
Image.open('my_picture.tif')
