问题
From Python PIL incorrectly decoding TIFF colors (using incorrect colorspace)?, I infer that it used to be possible to get PIL to dump a bunch of useful debugging output by setting PIL.Image.DEBUG = True
. However, this attribute no longer exists; per https://github.com/python-pillow/Pillow/issues/1191 it looks like it was replaced by usage of the built-in logging module a few years ago.
However, if I do
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()
then I get no logging output besides my 'Test' message.
What do I need to do to see debug logging from Pillow?
回答1:
To get the TIFF output that you're interested in -
from PIL import Image, TiffImagePlugin
TiffImagePlugin.DEBUG = True
Image.open('my_picture.tif')
来源:https://stackoverflow.com/questions/50255981/get-debug-output-from-pillow