python-pillow / python-pillow/Pillow
Perceptual hash
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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