Showing an image from console in Python

后端 未结 10 547
感动是毒
感动是毒 2020-12-02 20:42

What is the easiest way to show a .jpg or .gif image from Python console?

I\'ve got a Python console program that is checking a data set wh

10条回答
  •  有刺的猬
    2020-12-02 20:57

    Using the awesome Pillow library:

    >>> from PIL import Image                                                                                
    >>> img = Image.open('test.png')
    >>> img.show() 
    

    This will open the image in your default image viewer.

提交回复
热议问题