代码之家  ›  专栏  ›  技术社区  ›  Mark Amery Harley Holcombe

从Pillow获取调试输出

  •  2
  • Mark Amery Harley Holcombe  · 技术社区  · 8 年前

    从…起 Python PIL incorrectly decoding TIFF colors (using incorrect colorspace)? ,我推断,通过设置 PIL.Image.DEBUG = True 。但是,此属性不再存在;每 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查看调试日志记录?

    1 回复  |  直到 8 年前
        1
  •  1
  •   radarhere    7 年前

    获取您感兴趣的TIFF输出-

    from PIL import Image, TiffImagePlugin
    TiffImagePlugin.DEBUG = True
    Image.open('my_picture.tif')