Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image.show() won't display the picture

I'm running a python script but it won't show the picture.

I have an apple.jpg image in a directory with this program and it should show the picture, but it doesn't. Here is the code:

#!/usr/bin/env python  from PIL import Image  Apple = Image.open("apple.jpg") Apple.show() 

My OS is Ubuntu and this program just gets completed without showing any error.

like image 656
user2131116 Avatar asked Apr 29 '13 13:04

user2131116


People also ask

Why won't my image show up on my HTML page?

Why Is My Image Not Showing up in HTML? One of the reasons why your HTML image not showing in browser is that its file is not located in the same folder that is indicated within your tag. Also, the image may not load because the file name specified in the <img> tag does not match that of your image file.

How do I display an image in Python shell?

You cannot display images in a console window. You need a graphical toolkit such as Tkinter, PyGTK, PyQt, PyKDE, wxPython, PyObjC, or PyFLTK. There are plenty of tutorials on how to create simple windows and loading images in python.


1 Answers

It works for me on Ubuntu. It displays the image with Imagemagick. Try this:

sudo apt-get install imagemagick 
like image 155
Lennart Regebro Avatar answered Oct 02 '22 18:10

Lennart Regebro