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 which contains links to images stored locally. How should I write the script so that it would display images pop-up graphical windows?
Console applications are used primarily for text only applications. There is no way to display an image. You could launch another application which does display the image. This other application would most likely need to support a command line option to pass an image to it.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With