[Image-SIG] error in ImageChops.logical_xor ???

Fredrik Lundh fredrik at pythonware.com
Wed Oct 5 21:23:05 CEST 2005


"john taylor" wrote:

> i want to compare two images, they are of the same
> mode ('RGB'), same format ('BMP'), same size, etc.

here's a reasonably fast way to compare two images:

def compare(im1, im2):
    import ImageChops
    if im1.mode != im2.mode or im1.size != im2.size:
        return 0
    try:
        return ImageChops.difference(im1, im2).getbbox() is None
    except ValueError:
        return im1.tostring() == im2.tostring()

I think the logical operators (which are undocumented) only work on
mode "1" images.

</F> 





More information about the Image-SIG mailing list