fix: ruff lint + format fixes in tests, ESLint fixes in frontend
This commit is contained in:
@@ -71,13 +71,17 @@ def generate_thumbnail(
|
||||
background = Image.new("RGB", img.size, (255, 255, 255))
|
||||
if img.mode == "P":
|
||||
img = img.convert("RGBA")
|
||||
background.paste(img, mask=img.split()[-1] if img.mode in ("RGBA", "LA") else None)
|
||||
background.paste(
|
||||
img, mask=img.split()[-1] if img.mode in ("RGBA", "LA") else None
|
||||
)
|
||||
img = background
|
||||
elif img.mode != "RGB":
|
||||
img = img.convert("RGB")
|
||||
|
||||
# Use ImageOps.fit for a centered crop to exact thumbnail size
|
||||
thumbnail = ImageOps.fit(img, THUMBNAIL_SIZE, method=Image.Resampling.LANCZOS)
|
||||
thumbnail = ImageOps.fit(
|
||||
img, THUMBNAIL_SIZE, method=Image.Resampling.LANCZOS
|
||||
)
|
||||
thumbnail.save(thumbnail_path, quality=85, optimize=True)
|
||||
|
||||
logger.info("Thumbnail generated: %s", thumbnail_path)
|
||||
|
||||
Reference in New Issue
Block a user