ImageHash
Image Hashing library
What it is and what it does
ImageHash is a Python library that generates perceptual hashes from images—compact fingerprints that remain similar when images are visually alike but differ in compression, scaling, or minor edits. Unlike cryptographic hashes (MD5, SHA-1), where tiny changes produce completely different outputs, perceptual hashes are designed so that similar images produce similar hashes, measurable by Hamming distance. The library supports six hashing strategies: average hashing, perceptual hashing, difference hashing, wavelet hashing, HSV color hashing, and crop-resistant hashing. Each can be tuned for sensitivity by adjusting hash size or other parameters.
The package is built on pillow for image handling, numpy for numerical operations, scipy for Fourier transforms, and PyWavelets for wavelet analysis. It's commonly used to find duplicate or near-duplicate images in collections, implement reverse image search, detect manipulated images, and deduplicate media libraries. Hashes can be stored as hex strings, persisted in databases, and compared using fast Hamming distance queries.
Use it for:
- Deduplicate image libraries by computing hashes and finding images with Hamming distance below a threshold
- Build reverse image search by storing hashes in a database and querying for visually similar images
- Detect near-duplicate user uploads in content moderation or social media platforms
- Find cropped or slightly modified versions of images using crop-resistant hashing
- Analyze color distribution similarity between images using colorhash for palette-based matching
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ImageHash computes perceptual fingerprints of images using multiple hashing algorithms, allowing you to detect visually similar images even when they differ in compression, size, or minor edits.
Yes. ImageHash is mature, well-maintained, permissive-licensed, and has no known vulnerabilities. Install friction is low and it solves a specific, well-defined problem. Use it if you need to detect visually similar images; skip it if you only need exact image matching or cryptographic integrity checking.
Install
imagehash on PyPI
pip
pip install imagehashuv
uv add imagehashpoetry
poetry add imagehashInstalling ImageHash
Before you install
Low friction: pure Python wheel with four well-established scientific dependencies (numpy, scipy, pillow, PyWavelets). Last release was 2025-02-01; repository shows active maintenance with 3860 stars, though the package is aging (559 days since last release).
License in practice
2-clause BSD License is permissive; you can use, modify, and redistribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install imagehash
import imagehash
import pillow
hash1 = imagehash.average_hash(image1)
hash2 = imagehash.average_hash(image2)
if hash1 == hash2:
print('Images are similar')
Verify before relying
- Whether the package supports modern Python versions (requires_python is unspecified in metadata)
- Performance characteristics when hashing large image collections or very high-resolution images
- How to load images into the format expected by the hashing functions
Package facts
| License | 2-clause BSD License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — PyWavelets, numpy, pillow, scipy |
| Maintenance | aging — 559 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,039,544/month — #1,978 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ImageHash-4.3.2-py2.py3-none-any.whl
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
imagededupFinds exact and near-duplicate images in…
permissive · top 15,000 on PyPI
simhashComputes Simhash fingerprints for text and…
permissive · top 15,000 on PyPI
blurhash-pythonEncodes images into BlurHash strings, compact…
permissive · top 15,000 on PyPI
ppdeepppdeep computes fuzzy hashes (CTPH/ssdeep) to…
permissive · top 15,000 on PyPI
colorhashGenerates deterministic colors from any object…
permissive · top 15,000 on PyPI
filehashCalculates and verifies file checksums and…
permissive · top 15,000 on PyPI
py-tlshGenerates locality-sensitive hashes for fuzzy…
permissive · top 15,000 on PyPI
dict-hashGenerates consistent hashes for Python…
permissive · top 15,000 on PyPI
dirhashComputes a single hash value for an entire…
permissive · top 5,000 on PyPI
clandestinedImplements rendezvous hashing to locate objects…
permissive · top 5,000 on PyPI