Why am I receiving "AttributeError: module 'image' has no attribute 'Image'"?

2.1k Views Asked by At

When I try to execute the program below:

import image
img = image.Image("LutherBellPic.jpg")

print(img.getWidth())
print(img.getHeight())

p = img.getPixel(45, 55)
print(p.getRed(), p.getGreen(), p.getBlue())

I keep receiving the following error:

AttributeError: module 'image' has no attribute 'Image'
1

There are 1 best solutions below

0
Andreas Violaris On

Instead of the cImage package, you installed the image package.

Hence, you have to uninstall the wrong package, using this command:

pip uninstall image

and install the correct one, using this command:

pip install cImage

Details on each package may be found in the Python Package Index repository.

Ιn brief:

image package: image processing library for the Python-based web framework Django.

cImage package: image processing library for Python.