Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
15

image show with python

jduflos
jduflos

Hi there,

Is there a way to use the show() methode of the PIL.Image class in a repl ?
For now it only shows me the message

 display-im6.q16: unable to open X server `' @ error/display.c/DisplayImageCommand/432.

The code beeing

from PIL import Image img = Image.open("pomme.jpg") img.show()

the image I use :
pomme

3 years ago

Voters

Comments

TopNew
0

How do I make it so that it shows the image when I do :
from PIL import Image
img = Image.open("Hello.jpeg")
img.show()

No output comes

2 years ago
1
PaoloAmoroso
PaoloAmoroso

As far as I know Python REPLs support directly showing images only for Matplotlib, so the only workaround is to use the latter for image visualization. Or you may use Python from a Tkinter or Polygott REPL.

3 years ago
2
jduflos
jduflos

@PaoloAmoroso

Thank you for the answer. As I use Repl to teach python to 15 years old puiples, I don't want to add other libraries or use another platforme. Maybe later, when my students are more confident. For now, I use
image.save("output.jpg")
and I watch the result in the newly created file. The point is that it won't override the image if already created. So I'm looking for an easy way to deleat a file of the list.
Any suggestions ?

3 years ago
3

@jduflos
wow u teach 15 year olds, lol I, 11 and I’m just making some random code, are you a teacher?

2 years ago
Load more