update: PIL.Image constants moved to Resampling

This commit is contained in:
Hans-Christoph Steiner
2026-02-27 10:00:12 +01:00
committed by Michael Pöhn
parent 02139d196d
commit da58dc7c0a

View File

@@ -53,6 +53,9 @@ from binascii import hexlify
from PIL import Image, PngImagePlugin
if not hasattr(Image, 'Resampling'): # Pillow<9.0
Image.Resampling = Image
import fdroidserver.index
from . import _, common, metadata
@@ -324,7 +327,7 @@ def resize_icon(iconpath, density):
if any(length > size for length in im.size):
oldsize = im.size
im.thumbnail((size, size), Image.LANCZOS)
im.thumbnail((size, size), Image.Resampling.LANCZOS)
logging.debug("%s was too large at %s - new size is %s" % (
iconpath, oldsize, im.size))
im.save(iconpath, "PNG", optimize=True,
@@ -2397,7 +2400,7 @@ def fill_missing_icon_densities(empty_densities, icon_filename, apk, repo_dir):
size = dpi_to_px(density)
im.thumbnail((size, size), Image.LANCZOS)
im.thumbnail((size, size), Image.Resampling.LANCZOS)
im.save(icon_path, "PNG", optimize=True,
pnginfo=BLANK_PNG_INFO, icc_profile=None)
empty_densities.remove(density)