diff --git a/changedetectionio/content_fetchers/webdriver_selenium.py b/changedetectionio/content_fetchers/webdriver_selenium.py index 73c6dad40..eebf10579 100644 --- a/changedetectionio/content_fetchers/webdriver_selenium.py +++ b/changedetectionio/content_fetchers/webdriver_selenium.py @@ -156,6 +156,9 @@ class fetcher(Fetcher): from PIL import Image import io img = Image.open(io.BytesIO(screenshot_png)) + # Convert to RGB if needed (JPEG doesn't support transparency) + if img.mode != 'RGB': + img = img.convert('RGB') jpeg_buffer = io.BytesIO() img.save(jpeg_buffer, format='JPEG', quality=int(os.getenv("SCREENSHOT_QUALITY", 72))) self.screenshot = jpeg_buffer.getvalue()