Source: imagehash - хеширование изображений
← Renderedmarkdown source:
---
description: Хеширование изображений в python
title: imagehash - хеширование изображений
tags: pip python
---
[imagehash](https://github.com/JohannesBuchner/imagehash)
Библиотека хеширования изображений, написанная на Python. ImageHash поддерживает:
- Average hashing
- Perceptual hashing
- Difference hashing
- Wavelet hashing
- HSV color hashing (colorhash)
- Crop-resistant hashing
```python
>>> from PIL import Image
>>> import imagehash
>>> hash = imagehash.average_hash(Image.open('tests/data/imagehash.png'))
>>> print(hash)
ffd7918181c9ffff
>>> otherhash = imagehash.average_hash(Image.open('tests/data/peppers.png'))
>>> print(otherhash)
9f172786e71f1e00
>>> print(hash == otherhash)
False
>>> print(hash - otherhash) # hamming distance
33
```
Смотри еще:
- [Removing Duplicate or Similar Images in Python](https://towardsdatascience.com/removing-duplicate-or-similar-images-in-python-93d447c1c3eb)
- [How to Find Duplicate or Similar Images quickly with Python](https://medium.com/@somilshah112/how-to-find-duplicate-or-similar-images-quickly-with-python-2d636af9452f)
- [[PIL]]
- [[computer-visions]]
- [[python-standart-library]]
[PIL]: PIL "Pillow - обработка изображений"
[computer-visions]: ../lists/computer-visions "Computer visions"
[python-standart-library]: ../lists/python-standart-library "Стандартная библиотека python и полезные ресурсы"