skillfed

ImageHash

Image Hashing library

imagehash v4.3.2 6.0M downloads/30d#1,978 on PyPI3,860
Permissive license 2-clause BSD License AGING released

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 imagehash

uv

uv add imagehash

poetry

poetry add imagehash

Installing 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

image similarity detectionperceptual image hashingfind duplicate imagesimage fingerprintingvisual image comparisonhamming distance image searchcrop-resistant image hash
image-processingsimilarity-detectioncomputer-vision

More Graphics packages