title: Comparing two images whether same or not (iOS)
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6488732/how-does-one-compare-one-image-to-another-to-see-if-they-are-similar-by-a-certai">How does one compare one image to another to see if they are similar by a certain percentage, on the iPhone?</a>  </p>
  </blockquote>
  
  
  
  <p>I've found this code and am trying to understand it better:</p>
  
  <pre><code>UIImage *img1 = // Some photo;
  UIImage *img2 = // Some photo;
  
  NSData *imgdata1 = UIImagePNGRepresentation(img1);
  
  NSData *imgdata2 = UIImagePNGRepresentation(img2);
  
  if ([imgdata1 isEqualToData:imgdata2]) {
      NSLog(@"Same Image");
  }
  </code></pre>
  
  <p>Will this confirm that image 1 is exactly the same as image 2? Is this method best practice, or is there a better approach to this?</p>