Scrapy, a fast high-level web crawling & scraping framework for Python.
Fix transparency for processed webp images (#5767)
Steve Niafas7ae32ea38d9b
diff --git a/scrapy/pipelines/images.py b/scrapy/pipelines/images.pyindex 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')