fixed a bug

This commit is contained in:
eclipse 2025-06-03 10:54:23 +02:00
parent d2dba5b815
commit d09c81d65e

View File

@ -56,7 +56,7 @@ def create():
bytes_io.seek(0) bytes_io.seek(0)
img = Image.open(bytes_io) img = Image.open(bytes_io)
w, h, img_format = img.width, img.height, img.format w, h, img_format = img.width, img.height, img.format
img.thumbnail(dimensions) img.thumbnail([128, 128])
tn = BytesIO() tn = BytesIO()
img.save(tn, format=img_format) img.save(tn, format=img_format)
@ -138,13 +138,3 @@ def makeshift_digest(bytes_io):
h.update(mv[:n]) h.update(mv[:n])
return h.hexdigest() return h.hexdigest()
# takes a BytesIO object containing an image and creates a Pillow thumbnail from it
def _process_image_bytes(bytes_io, dimensions=[128, 128]):
bytes_io.seek(0)
img = Image.open(bytes_io)
tn_format = img.format
img.thumbnail(dimensions)
tn = BytesIO()
img.save(tn, format=tn_format)
return (tn.getvalue(), tn_format)