Accept HEIC image format labels

This commit is contained in:
2026-09-20 02:38:46 +03:30
parent f392b68851
commit dcdeafaae1
2 changed files with 26 additions and 2 deletions
+4 -2
View File
@@ -128,8 +128,10 @@ def public_text(text):
def web_image(raw, destination):
with Image.open(io.BytesIO(raw)) as original:
if original.format not in {"JPEG", "PNG", "WEBP", "HEIF", "AVIF", "TIFF"}:
raise ValueError("Use JPEG, PNG, WebP, HEIC, AVIF, or TIFF photos")
if original.format not in {"JPEG", "PNG", "WEBP", "HEIF", "HEIC", "AVIF", "TIFF"}:
raise ValueError(
f"Detected {original.format or 'unknown'}; use JPEG, PNG, WebP, "
"HEIF/HEIC, AVIF, or TIFF photos")
taken_at = exif_photo_date(original.getexif())
image = ImageOps.exif_transpose(original)
image.thumbnail((GALLERY_MAX_EDGE, GALLERY_MAX_EDGE), Image.Resampling.LANCZOS)