Possible Duplicate:
img = Image.open(fp) AttributeError: class Image has no attribute ‘open’
So I am trying to view pictures in python with tkinter. I installed PIL and I am trying to open a picture but I keep getting an attribute error saying "class Image has no attribute 'open'
from __future__ import division
from PIL import Image
from Tkinter import *
import random
img = Image.open("majestic creature.jpeg").convert("RGB")
This isn't all the code I have but this is the part that the program seems to have trouble with.
From the looks of what you have said, namely This is not all of the code.
You or some other import has declared some variable / class called Image and this has overwritten the Image class that was imported by PIL.
To specifically use the PIL Image class use:
img = PIL.Image.open("majestic creature.jpeg").convert("RGB")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With