First you need to come up with a reliable metric to determine if two images are the same (in appearance, not necessarily data.)