From 40caf5f3fe17d75f74fbf75d950fd7ae1f842508 Mon Sep 17 00:00:00 2001 From: Paul Friederichsen Date: Fri, 11 Aug 2023 21:58:36 -0500 Subject: [PATCH] Replace PILImage.ANTIALIAS with PILImage.LANCZOS ANTIALIAS was removed in Pillow 10 --- hydrus/core/HydrusImageHandling.py | 2 +- hydrus/core/HydrusPSDHandling.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hydrus/core/HydrusImageHandling.py b/hydrus/core/HydrusImageHandling.py index ee364e69..474392d0 100644 --- a/hydrus/core/HydrusImageHandling.py +++ b/hydrus/core/HydrusImageHandling.py @@ -489,7 +489,7 @@ def GenerateThumbnailBytesFromStaticImagePath( path, target_resolution, mime, cl pil_image = ClipPILImage( pil_image, clip_rect ) - thumbnail_pil_image = pil_image.resize( target_resolution, PILImage.ANTIALIAS ) + thumbnail_pil_image = pil_image.resize( target_resolution, PILImage.LANCZOS ) thumbnail_bytes = GenerateThumbnailBytesPIL( thumbnail_pil_image ) diff --git a/hydrus/core/HydrusPSDHandling.py b/hydrus/core/HydrusPSDHandling.py index f8d82c82..22087b45 100644 --- a/hydrus/core/HydrusPSDHandling.py +++ b/hydrus/core/HydrusPSDHandling.py @@ -3,7 +3,7 @@ import typing from PIL import Image as PILImage -from hydrus.core import HydrusImageHandling +from hydrus.core import HydrusExceptions, HydrusImageHandling try: @@ -20,7 +20,7 @@ def PSDHasICCProfile(path: str): if not PSD_TOOLS_OK: - raise Exception( 'psd_tools unavailable' ) + raise HydrusExceptions.UnsupportedFileException( 'psd_tools unavailable' ) psd = PSDImage.open(path) @@ -31,7 +31,7 @@ def MergedPILImageFromPSD(path: str) -> PILImage: if not PSD_TOOLS_OK: - raise Exception( 'psd_tools unavailable' ) + raise HydrusExceptions.UnsupportedFileException( 'psd_tools unavailable' ) psd = PSDImage.open(path) @@ -68,7 +68,7 @@ def GenerateThumbnailBytesFromPSDPath(path: str, target_resolution: typing.Tuple pil_image = HydrusImageHandling.ClipPILImage( pil_image, clip_rect ) - thumbnail_pil_image = pil_image.resize( target_resolution, PILImage.ANTIALIAS ) + thumbnail_pil_image = pil_image.resize( target_resolution, PILImage.LANCZOS ) thumbnail_bytes = HydrusImageHandling.GenerateThumbnailBytesPIL( thumbnail_pil_image )