From e1b1dc9873e506e81639b6b4e35a8c480ebbe524 Mon Sep 17 00:00:00 2001 From: phette23 Date: Fri, 26 Jul 2024 10:02:47 -0700 Subject: [PATCH] feat: support webp images --- flask_iiif/config.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/flask_iiif/config.py b/flask_iiif/config.py index 30e1793..bee65bd 100644 --- a/flask_iiif/config.py +++ b/flask_iiif/config.py @@ -89,6 +89,7 @@ "png": "image/png", "tif": "image/tiff", "tiff": "image/tiff", + "webp": "image/webp", } IIIF_FORMATS_PIL_MAP = { @@ -100,6 +101,7 @@ "png": "png", "tif": "tiff", "tiff": "tiff", + "webp": "webp", } # Regular expressions to validate each parameter @@ -117,7 +119,10 @@ }, "rotation": {"ignore": "0", "validate": "^[\d.]+$"}, "quality": {"ignore": "default", "validate": "(native|color|gr[ae]y|bitonal)"}, - "image_format": {"ignore": "", "validate": "(gif|jp2|jpe?g|pdf|png|tiff?)"}, + "image_format": { + "ignore": "", + "validate": "(gif|jp2|jpe?g|pdf|png|tiff?|webp)", + }, }, "v2": { "region": { @@ -132,7 +137,10 @@ }, "rotation": {"ignore": "0", "validate": "^!?[\d.]+$"}, "quality": {"ignore": "default", "validate": "(default|color|gr[ae]y|bitonal)"}, - "image_format": {"ignore": "", "validate": "(gif|jp2|jpe?g|pdf|png|tiff?)"}, + "image_format": { + "ignore": "", + "validate": "(gif|jp2|jpe?g|pdf|png|tiff?|webp)", + }, }, }