How perceptual hashing finds duplicates
The Duplicate Photo Scanner uses the dHash (difference hash) algorithm to create a compact 64-bit visual fingerprint for each image. First, the image is resized to 9×8 pixels and converted to grayscale, removing color information and size differences. Then the algorithm compares each pixel to its right neighbor — if the left pixel is brighter, it records a 1; otherwise, a 0. This produces a 64-bit binary hash that captures the image's gradient structure. Two images with similar visual content will produce similar hashes regardless of resolution, file format, slight cropping, or JPEG recompression. The Similarity Scanner uses a different approach for detailed side-by-side comparison of two specific images.