Get debug output from Pillow

风格不统一 提交于 2019-12-11 00:55:53

问题


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

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