Products > Programming
Viewing JPG Images in Python Using XP
bostonman:
I have an XP machine with Python 3.3 and I'm trying to create a program that will view images in a directory randomly. I'm starting with the basic approach of trying to just open/view an image and found multiple ways to do it, however, none of them work (after I figure out this, then I'll move onto incorporating a random viewing program).
I'm using Notepad++, saving it as a filename.py, and double clicking the .py file.
The most basic one that I found that causes a window to open and close without doing anything else is:
from PIL import Image
#read the image
im = Image.open("image.jpg")
#show image
im.show()
ataradov:
You nee to run it from the command line or some IDE and you will see the error output. In this specific case you likely have no PIL library installed.
bostonman:
I tried installing PIL, Pillow (thought I read Pillow replaced PIL), etc...
Seems I couldn't install it no matter what format I tried.
ataradov:
Run it from the command line and looks at the reported error.
bostonman:
>>> pip install pil
File "<stdin>", line 1
pip install pil
Navigation
[0] Message Index
[#] Next page
Go to full version