python-pyssim/pillow10.patch
Steve Kowalik bcff58c0f4 - Update to 0.7:
* Drop Python 3.7 support.
  * Add Python 3.12 support.
  * Update support for newer versions of PIL/Pillow.
- Drop patch pillow10.patch, included upstream.
- Add patch use-pywavelets.patch:
  * Use PyWavelets rather scipy.signal for CWT.
- Switch to pyproject macros.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pyssim?expand=0&rev=13
2025-02-06 03:38:59 +00:00

56 lines
2.1 KiB
Diff

From db4296c12ca9c027eb9cd61b52195a78dfcc6711 Mon Sep 17 00:00:00 2001
From: Theodore Ni <3806110+tjni@users.noreply.github.com>
Date: Sun, 27 Aug 2023 11:36:25 -0700
Subject: [PATCH] Replace Image.ANTIALIAS with Image.LANCZOS
This adds compatibility with Pillow 10, when ANTIALIAS was removed.
Meanwhile, LANCZOS has been an alias since Pillow 2.7.0.
Co-authored-by: emilylange <git@emilylange.de>
---
SSIM_CW-SSIM_comparison.ipynb | 8 ++++----
ssim/ssimlib.py | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/SSIM_CW-SSIM_comparison.ipynb b/SSIM_CW-SSIM_comparison.ipynb
index e713ffd..68ea8ce 100644
--- a/SSIM_CW-SSIM_comparison.ipynb
+++ b/SSIM_CW-SSIM_comparison.ipynb
@@ -34,19 +34,19 @@
"size = (256,256)\n",
"\n",
"im = Image.open('test-images/test3-orig.jpg')\n",
- "im = im.resize(size, Image.ANTIALIAS)\n",
+ "im = im.resize(size, Image.LANCZOS)\n",
"\n",
"# slightly rotated image\n",
"im_rot = Image.open('test-images/test3-rot.jpg')\n",
- "im_rot = im_rot.resize(size, Image.ANTIALIAS)\n",
+ "im_rot = im_rot.resize(size, Image.LANCZOS)\n",
"\n",
"# slightly modified lighting conditions\n",
"im_lig = Image.open('test-images/test3-lig.jpg')\n",
- "im_lig = im_lig.resize(size, Image.ANTIALIAS)\n",
+ "im_lig = im_lig.resize(size, Image.LANCZOS)\n",
"\n",
"# image cropped\n",
"im_cro = Image.open('test-images/test3-cro.jpg')\n",
- "im_cro = im_cro.resize(size, Image.ANTIALIAS)"
+ "im_cro = im_cro.resize(size, Image.LANCZOS)"
]
},
{
diff --git a/ssim/ssimlib.py b/ssim/ssimlib.py
index 693f951..b40a8d4 100644
--- a/ssim/ssimlib.py
+++ b/ssim/ssimlib.py
@@ -45,7 +45,7 @@ def __init__(self, img, gaussian_kernel_1d=None, size=None):
# Resize image if size is defined and different
# from original image
if size and size != self.img.size:
- self.img = self.img.resize(size, Image.ANTIALIAS)
+ self.img = self.img.resize(size, Image.LANCZOS)
# Set the size of the image
self.size = self.img.size