2011-03-16 28 views
13
def show(): 

    file = raw_input("What is the name of the image file? ") 

    picture = Image(file) 

    width, height = picture.size() 

    pix = picture.getPixels() 

Estoy tratando de escribir un código para mostrar esta imagen, pero este código no proporciona la imagen. ¿Cómo cambiar mi código para ver esta imagen?¿Cómo mostrar un archivo jpg en Python?

+1

recordar para seleccionar una respuesta aceptada por su pregunta para que otro podría beneficiarse de ella también. – tiagoboldt

+0

Por favor busca. Por favor. Esta es una pregunta duplicada. Todos estos son relevantes. http://stackoverflow.com/search?q=python+display+image –

Respuesta

29
import Image 

image = Image.open('File.jpg') 
image.show() 
+1

esto acaba de lanzar una aplicación de visor externo – endolith

15

No se olvide de incluir

import Image 

Con el fin de mostrar que usan este:

Image.open('pathToFile').show() 
+1

tiene un 2 º lugar thrumps up – easymoden00b

Cuestiones relacionadas