importing python modules - ImageChops
Question: I'm looking for a good way to analyze image similarity, using python. I'm NOT
looking for a way to establish whether two images are identical. I'm just
looking for a way to establish the similarity between two images (e.g., if two
images are very similar they could be given a "grade" of 9/10; if they are
completely unalike, they'll be given a very low index, such as 2/10). From
some reading that I've done, the module ImageChops has been suggested -
however, I haven't been able to find a way to download it. If anyone knows how
to download it, or has a suggestion for other effective solutions, I'd greatly
appreciate their advice!

Thanks in advance!


Answer: [ImageChops is a module from PIL(Pillow)](https://github.com/python-
imaging/Pillow/blob/master/PIL/ImageChops.py). To use the ImageChops function
you need to `pip install Pillow` OR `easy_install Pillow` OR [download the
src](https://github.com/python-imaging/Pillow) & extract the src then from CMD
CD to the extracted folder & run `python setup.py install`.

To use the ImageChops you can do this `from PIL import ImageChops` you can
read the [document section](http://pillow.readthedocs.org/en/latest/PIL.html)

some basic usage example <http://effbot.org/imagingbook/imagechops.htm>

To check the difference between 2 images:

    
    
    import Image
    from PIL import ImageChops
    
    im1 = Image.open("splash.png")
    im2 = Image.open("splash2.png")
    
    diff = ImageChops.difference(im2, im1)
    

there's a [compare images script](https://gist.github.com/astanin/626356), but
its not a PIL; its on [scipy module](https://github.com/scipy/scipy) You may
also check [this script
here](http://code.activestate.com/recipes/577630-comparing-two-images/)

