From 7ae32ea38d9b78402528ac3dffc8e1c5f1cf86b7 Mon Sep 17 00:00:00 2001 From: Steve Niafas Date: Thu, 22 Dec 2022 15:33:14 +0200 Subject: [PATCH] Fix transparency for processed webp images (#5767) --- scrapy/pipelines/images.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrapy/pipelines/images.py b/scrapy/pipelines/images.py index 6a28a3b87..d92f24d56 100644 --- a/scrapy/pipelines/images.py +++ b/scrapy/pipelines/images.py @@ -171,7 +171,7 @@ class ImagesPipeline(FilesPipeline): 'method called without response_body argument.', category=ScrapyDeprecationWarning, stacklevel=2) - if image.format == 'PNG' and image.mode == 'RGBA': + if image.format in ('PNG', 'WEBP') and image.mode == 'RGBA': background = self._Image.new('RGBA', image.size, (255, 255, 255)) background.paste(image, image) image = background.convert('RGB')