-2

I have:

Pillow-3.4.0-cp34-cp34--win32.whl (md5) (which I found here)

Python-3.4.0.amd64

Pyscripter-v2.6.0-setup

I am attempting to create a program that can compare two images and have come across a problem to do with PIL. As I understand it, you have to download Pillow and import the 'Image' module from it. I have downloaded the above Pillow program and this is the various codes I have tried to use:

from Pillow import Image

OR

import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
     for i in installed_packages])
print(installed_packages_list)
import Pillow
import Image

OR SIMPLY

import Image

None of these have worked (they come up with various different error messages including 'no module named Pillow/PIL/Image') and I have tried a couple other slight variants on these but still, none have worked. I am looking for perfection rather than simplicity and anything useful would be amazing. Thankyou. Also, if anyone can provide a way that will account for brightness differences (I am trying to compare a picture of an image on a screen with the image itself).

martineau
  • 119,623
  • 25
  • 170
  • 301
  • A `from PIL import Image` imports the `Image` package from `pillow`. You don't actually use the name `Pillow`, it's a fork of the original `PIL` module. You then need to write code which uses functions in the package to create or read an image from your hard-disk into your program. Suggest you read the [documentation](http://pillow.readthedocs.io/en/4.2.x/reference/Image.html) for examples. The exact version you're using shouldn't matter, as these are basic functions from the original `PIL` module. – martineau Jul 02 '17 at 17:32

1 Answers1

0

Try this

from PIL import Image, ImageFont, ImageDraw

im = Image.new('RGB', (100,400), (255,0,0))
dr = ImageDraw.Draw(im)

This code cpuld draw images,just try it if it works. My PIL version

 PIL.__version__
'4.0.0'
MishaVacic
  • 1,812
  • 8
  • 25
  • 29