python-pillow / python-pillow/Pillow

Perceptual hash

Open
#3,120 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Python
Stars
13.8k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
89

Description

For finding duplicates, it would be nice if Pillow would include some perceptual hashing algorithm:
https://en.wikipedia.org/wiki/Perceptual_hashing

The real use case for me is that my in my photo collection I often have the same image in different resolutions, e.g. if I sent it via WhatsApp: Once in full resolution from the camera, once in reduced resolution in WhatsApp.

Here is a blog post describing a simple algorithm that also uses Pillow:
https://www.safaribooksonline.com/blog/2013/11/26/image-hashing-with-python/
but it would be more convenient to have some function builtin,
most interesting something like image.signature or image.phash and then some function to calculate the similarity or distance between two or more images.

One library mentioned quite often in this context is phash:
http://www.phash.org/
Maybe their algorithms could be reused?

If this is out of scope for Pillow I would just use one the projects providing phash python bindings.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No Pillow file or test is named in the issue. Start by reviewing the requested perceptual-hashing API, the linked algorithm description, and the phash project, then clarify which algorithm and comparison behavior are in scope. Done means the project has an agreed implementation and API with corresponding tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.