+gaussian_kernel = ImageFilter.Kernel((3, 3), [1, 2, 1, 2, 4, 2, 1, 2, 1], 16)
+
+class Comparer:
+ '''Image comparer.'''
+
+ def __init__(self, ref_image, src_image, alpha = False):
+ if isinstance(ref_image, basestring):
+ self.ref_im = Image.open(ref_image)
+ else:
+ self.ref_im = ref_image
+
+ if isinstance(src_image, basestring):
+ self.src_im = Image.open(src_image)
+ else:
+ self.src_im = src_image
+
+ # Ignore
+ if not alpha:
+ self.ref_im = self.ref_im.convert('RGB')
+ self.src_im = self.src_im.convert('RGB')