def near_identical(im1, im2):
 diff = ImageChops.difference(im1, im2).histogram()
 for color in diff[2:]:
  if color:
   return False
 return True

def near_identical ( im1 , im2 ) : diff = ImageChops . difference ( im1 , im2 ) . histogram ( ) for color in diff [ 2 : ] : if color : return False return True
check if two images are identical .