HOME/Articles/

pil example imagehash phash lenna (snippet)

Article Outline

Python pil example 'imagehash phash lenna'

Modules used in program:

  • import imagehash
  • import PIL

python imagehash phash lenna

Python pil example: imagehash phash lenna

# Code for the blogpost https://fullstackml.com/2016/07/02/wavelet-image-hash-in-python/
import PIL
from PIL import Image
import imagehash

lenna = PIL.Image.open(‘lenna.png’)
lenna1 = PIL.Image.open(‘lenna1.jpg’)

h = imagehash.phash(lenna)
h1 = imagehash.phash(lenna1)
h-h1
# > 0