code: def percentSame(image1, image2):
          '''
          Returns the percent of pixels that are equal
  
          @author: catshoes
          '''
  
          # If the images differ in size, return 0% same.
          size_x1, size_y1 = image1.size
          size_x2, size_y2 = image2.size
          if (size_x1 != size_x2 or
                      size_y1 != size_y2):
              return 0
  
          # Images are the same size
          # Return the percent of pixels that are equal.
          numPixelsSame = 0
          numPixelsTotal = size_x1 * size_y1
          image1Pixels = image1.load()
          image2Pixels = image2.load()
  
          # Loop over all pixels, comparing pixel in image1 to image2
          for x in range(size_x1):
              for y in range(size_y1):
                  if image1Pixels[x, y] == image2Pixels[x, y]:
                      numPixelsSame += 1
  
          return numPixelsSame / float(numPixelsTotalf percentSame(image1, image2):
          '''
          Returns the percent of pixels that are equal
  
          @author: catshoes
          '''
  
          # If the images differ in size, return 0% same.
          size_x1, size_y1 = image1.size
          size_x2, size_y2 = image2.size
          if (size_x1 != size_x2 or
                      size_y1 != size_y2):
              return 0
  
          # Images are the same size
          # Return the percent of pixels that are equal.
          numPixelsSame = 0
          numPixelsTotal = size_x1 * size_y1
          image1Pixels = image1.load()
          image2Pixels = image2.load()
  
          # Loop over all pixels, comparing pixel in image1 to image2
          for x in range(size_x1):
              for y in range(size_y1):
                  if image1Pixels[x, y] == image2Pixels[x, y]:
                      numPixelsSame += 1
  
          return numPixelsSame / float(numPixelsTotal)
docs: Returns the percent of pixels that are equal
  
          @author: catshoes