diff --git a/inkycal/modules/inky_image.py b/inkycal/modules/inky_image.py index 49eae64..c78dff6 100644 --- a/inkycal/modules/inky_image.py +++ b/inkycal/modules/inky_image.py @@ -15,6 +15,8 @@ import numpy import os import logging +from PIL.Image import Resampling + filename = os.path.basename(__file__).split('.py')[0] logger = logging.getLogger(filename) @@ -178,7 +180,7 @@ class Inkyimage: initial_width = image.width wpercent = (width / float(image.width)) hsize = int((float(image.height) * float(wpercent))) - image = image.resize((width, hsize), Image.ANTIALIAS) + image = image.resize((width, hsize), Resampling.LANCZOS) logger.info(f"resized image from {initial_width} to {image.width}") self.image = image @@ -186,7 +188,7 @@ class Inkyimage: initial_height = image.height hpercent = (height / float(image.height)) wsize = int(float(image.width) * float(hpercent)) - image = image.resize((wsize, height), Image.ANTIALIAS) + image = image.resize((wsize, height), Resampling.LANCZOS) logger.info(f"resized image from {initial_height} to {image.height}") self.image = image diff --git a/inkycal/tests/inkycal_image_test.py b/inkycal/tests/inkycal_image_test.py index 9f27821..6913245 100644 --- a/inkycal/tests/inkycal_image_test.py +++ b/inkycal/tests/inkycal_image_test.py @@ -6,6 +6,10 @@ Copyright by aceisace """ import unittest + +import requests +from PIL import Image + from inkycal.modules import Inkyimage as Module from inkycal.custom import top_level from helper_functions import * @@ -15,7 +19,11 @@ environment = get_environment() # Set to True to preview images. Only works on Raspberry Pi OS with Desktop use_preview = False -test_path = f'{top_level}/Gallery/coffee.png' +url = "https://github.com/aceisace/Inkycal/raw/assets/Repo/coffee.png" + +im = Image.open(requests.get(url, stream=True).raw) +im.save("test.png", "PNG") +test_path = "test.png" tests = [ {