Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 5a80152

Browse files
committed
pinned last pillow version
1 parent 2fa2f04 commit 5a80152

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

python/imagehash.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
def average_hash(image, hash_size=8, mean=numpy.mean):
4343
# reduce size and complexity, then covert to grayscale
44-
image = image.convert("L").resize((hash_size, hash_size), Image.ANTIALIAS)
44+
image = image.convert("L").resize((hash_size, hash_size), Image.LANCZOS)
4545
# find average pixel value; 'pixels' is an array of the pixel values, ranging from 0 (black) to 255 (white)
4646
pixels = numpy.asarray(image)
4747
avg = mean(pixels)
@@ -51,7 +51,7 @@ def average_hash(image, hash_size=8, mean=numpy.mean):
5151

5252
def phash(image, hash_size=8, highfreq_factor=4):
5353
img_size = hash_size * highfreq_factor
54-
image = image.convert("L").resize((img_size, img_size), Image.ANTIALIAS)
54+
image = image.convert("L").resize((img_size, img_size), Image.LANCZOS)
5555
pixels = numpy.asarray(image)
5656
dct = scipy.fftpack.dct(scipy.fftpack.dct(pixels, axis=0), axis=1)
5757
dctlowfreq = dct[:hash_size, :hash_size]
@@ -62,7 +62,7 @@ def phash(image, hash_size=8, highfreq_factor=4):
6262

6363
def phash_simple(image, hash_size=8, highfreq_factor=4):
6464
img_size = hash_size * highfreq_factor
65-
image = image.convert("L").resize((img_size, img_size), Image.ANTIALIAS)
65+
image = image.convert("L").resize((img_size, img_size), Image.LANCZOS)
6666
pixels = numpy.asarray(image)
6767
dct = scipy.fftpack.dct(pixels)
6868
dctlowfreq = dct[:hash_size, 1 : hash_size + 1]
@@ -72,15 +72,15 @@ def phash_simple(image, hash_size=8, highfreq_factor=4):
7272

7373

7474
def dhash(image, hash_size=8):
75-
image = image.convert("L").resize((hash_size + 1, hash_size), Image.ANTIALIAS)
75+
image = image.convert("L").resize((hash_size + 1, hash_size), Image.LANCZOS)
7676
pixels = numpy.asarray(image)
7777
# compute differences between columns
7878
diff = pixels[:, 1:] > pixels[:, :-1]
7979
return diff
8080

8181

8282
def dhash_vertical(image, hash_size=8):
83-
image = image.convert("L").resize((hash_size, hash_size + 1), Image.ANTIALIAS)
83+
image = image.convert("L").resize((hash_size, hash_size + 1), Image.LANCZOS)
8484
pixels = numpy.asarray(image)
8585
# compute differences between rows
8686
diff = pixels[1:, :] > pixels[:-1, :]
@@ -101,7 +101,7 @@ def whash(image, hash_size=8, image_scale=None, mode="haar", remove_max_haar_ll=
101101
assert level <= ll_max_level, "hash_size in a wrong range"
102102
dwt_level = ll_max_level - level
103103

104-
image = image.convert("L").resize((image_scale, image_scale), Image.ANTIALIAS)
104+
image = image.convert("L").resize((image_scale, image_scale), Image.LANCZOS)
105105
pixels = numpy.asarray(image) / 255.0
106106

107107
# Remove low level frequency LL(max_ll) if @remove_max_haar_ll using haar filter

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
numpy
22
scipy
33
pywavelets
4-
pillow==9.5.0
4+
pillow==10.1.0
55
hexhamming
66
nc-py-api==0.0.11
77
pi-heif>=0.9.0

0 commit comments

Comments
 (0)