Image.ANTIALIAS->Image.LANCZOS

This commit is contained in:
j 2023-08-25 00:18:23 +02:00
parent b4fbb863af
commit 4414998759

View file

@ -57,7 +57,7 @@ def getHSL(rgb):
return tuple(hsl) return tuple(hsl)
def getImageHash(image_file, mode): def getImageHash(image_file, mode):
image = Image.open(image_file).convert('RGB').resize((8, 8), Image.ANTIALIAS) image = Image.open(image_file).convert('RGB').resize((8, 8), Image.LANCZOS)
image_hash = 0 image_hash = 0
if mode == 'color': if mode == 'color':
# divide the image into 8 zones: # divide the image into 8 zones:
@ -99,7 +99,7 @@ def getImageHash(image_file, mode):
return image_hash return image_hash
def getImageHeat(image_file): def getImageHeat(image_file):
image = Image.open(image_file).convert('RGB').resize((16, 16), Image.ANTIALIAS) image = Image.open(image_file).convert('RGB').resize((16, 16), Image.LANCZOS)
pixel = image.load() pixel = image.load()
image_heat = 0 image_heat = 0
for y in range(image.size[1]): for y in range(image.size[1]):
@ -114,7 +114,7 @@ def getImageHeat(image_file):
return image_heat / 256 return image_heat / 256
def getImageHSL(image_file): def getImageHSL(image_file):
image = Image.open(image_file).convert('RGB').resize((1, 1), Image.ANTIALIAS) image = Image.open(image_file).convert('RGB').resize((1, 1), Image.LANCZOS)
return getHSL(image.getpixel((0, 0))) return getHSL(image.getpixel((0, 0)))
def getRGB(hsl): def getRGB(hsl):