Skip to content

Commit 4e289eb

Browse files
Merge pull request #216 from saim61/colorhash_fix
colorhash: overflow encountered in scalar multiply
2 parents 07951cd + f62f120 commit 4e289eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

imagehash/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def colorhash(image, binbits=3):
438438
maxvalue = 2**binbits
439439
values = [min(maxvalue - 1, int(frac_black * maxvalue)), min(maxvalue - 1, int(frac_gray * maxvalue))]
440440
for counts in list(h_faint_counts) + list(h_bright_counts):
441-
values.append(min(maxvalue - 1, int(counts * maxvalue * 1. / c)))
441+
values.append(min(maxvalue - 1, int(counts / c * maxvalue)))
442442
# print(values)
443443
bitarray = []
444444
for v in values:

0 commit comments

Comments
 (0)