title: Detecting if two images are visually identical
body: <p>Sometimes two image files may be different on a file level, but a human would consider them perceptively identical. Given that, now suppose you have a huge database of images, and you wish to know if a human would think some image X is present in the database or not. If all images had a perceptive hash / fingerprint, then one could hash image X and it would be a simple matter to see if it is in the database or not.</p>
  
  <p>I know there is research around this issue, and some algorithms exist, but is there any tool, like a UNIX command line tool or a library I could use to compute such a hash without implementing some algorithm from scratch?</p>
  
  <p>edit: relevant code from findimagedupes, using ImageMagick</p>
  
  <pre><code>try $image-&gt;Sample("160x160!");
  try $image-&gt;Modulate(saturation=&gt;-100);
  try $image-&gt;Blur(radius=&gt;3,sigma=&gt;99);
  try $image-&gt;Normalize();
  try $image-&gt;Equalize();
  try $image-&gt;Sample("16x16");
  try $image-&gt;Threshold();
  try $image-&gt;Set(magick=&gt;'mono');
  ($blob) = $image-&gt;ImageToBlob();
  </code></pre>
  
  <p>edit: <strong>Warning!</strong> ImageMagick $image object seems to contain information about the creation time of an image file that was read in. This means that the blob you get will be different even for the same image, if it was retrieved at a different time. To make sure the fingerprint stays the same, use $image->getImageSignature() as the last step.</p>