﻿# ImageHash dataset matching: crops, color changes and misleading small distances

Choose a perceptual-image representation and inspect candidate matches instead of treating a shared hash or Hamming threshold as document identity.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/data-guide-perceptual-hash-crop-collision/
Language: en

## Different algorithms preserve different information

ImageHash includes several structural hashes, a color hash and crop-resistant hashing. Its documentation distinguishes luminance-oriented structure from color-distribution information. Calling all of these outputs image similarity hides which changes the representation can detect.

Choose the representation against the dataset task. A recolored chart, a changed legend and a resized photograph are not necessarily interchangeable examples. A match that is acceptable for finding repeated thumbnails can be inappropriate for removing distinct visual-question-answering records.

## Distance has meaning within a compatible representation

The library demonstrates subtracting compatible hashes to obtain Hamming distance. Hash size changes the retained detail and sensitivity. Algorithm, size and preprocessing must therefore travel with persisted values, rather than treating every hexadecimal string as belonging to a common distance scale.

Keep original image identity beside the perceptual fingerprint. Cryptographic payload identity and visual candidate similarity answer different questions. Re-encoding can change the payload without meaningfully changing a picture, while a small visual modification can change a task's correct answer.

## Cropping changes which content remains visible

A whole-image fingerprint can respond strongly to cropping. ImageHash's crop-resistant implementation segments an image and hashes segments, creating a different matching representation. It should not be treated as a magic setting that makes every crop equivalent to the full original.

Inspect what was removed. A crop may exclude a warning, caption or object needed to interpret the retained image. Similar surviving regions are evidence of a relationship, not automatic evidence that both records can be collapsed without losing task-relevant information.

## A quality signal belongs to its algorithm

Meta's PDQ reference implementation describes a perceptual hash with a separate quality metric intended to identify featureless or uninformative images for its processing workflow. That is a specific signal with a specific purpose.

It is not a general assessment of dataset usefulness or a transferable confidence score for another hashing library. An intentionally simple diagram can be valuable training material. Keep algorithm-specific quality handling separate from the semantic decision about whether the dataset needs that example.

## Review clusters before removing records

A proposed evaluation should include recompressed copies, resized images, crops, color-only differences and unrelated images with simple layouts. Inspect false merges and missed matches separately. No matching accuracy or preferred threshold is claimed for an untested collection.

Save candidate edges, review decisions and retained source provenance. If the representation changes, rebuild fingerprints and compare affected clusters. This makes perceptual matching useful for corpus review without promoting one approximate distance to a universal proof of image equivalence.

## Primary references

[ImageHash project documentation](https://github.com/JohannesBuchner/imagehash).

[ImageHash implementation](https://raw.githubusercontent.com/JohannesBuchner/imagehash/master/imagehash/__init__.py).

[PDQ reference implementation documentation](https://raw.githubusercontent.com/facebook/ThreatExchange/main/pdq/README.md).

Related explanations: [Image and text representations](/journal/clip-image-text-contrastive-space/); [Derived-data provenance](/journal/document-markdown-json-provenance/).
