title: Comparing image in url to image in filesystem in python
body: <p>Is there a quick and easy way to do such comparison?</p>
  
  <p>I've found few image compare questions from stackoverflow but none of those actually proved answer for this question.</p>
  
  <p>I have images files in my filesystem and a script that fetches images from urls. I want to check if the image in url is already the same that is on disk. Normally I would load the image in disk and url to a PIL object and use following function I found:</p>
  
  <pre><code>def equal(im1, im2):
      return ImageChops.difference(im1, im2).getbbox() is None
  </code></pre>
  
  <p>but this doesn't work if you have a image saved to disk with PIL as it gets compressed even if you turn the quality to 100 <code>im1.save(outfile,quality=100)</code>. </p>
  
  <p>My code is currently following: 
  <a href="http://pastebin.com/295kDMsp" rel="nofollow">http://pastebin.com/295kDMsp</a>
  but the image always ends up re-saved.</p>