Hi, I'm a beginner, and just want to display an image using Python. I have this code...

from PIL import Image

which according to what I've read, should work. However, it just opens Windows Photo Gallery and says 'There are no photos or videos selected'.

I have ensured that the image file is named correctly and is within the same directory as the Python script.

Any help?

Never mind, seems it was something to do with Vista... solved it by doing this instead...

import Image, os

img = Image.open("image.jpg")

Im pretty sure that using the Image module is unnessicary for that. I think you can just use os and go:

import os

Yep, just checked, it works perfectly on my computer.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.