fix cannot write mode RGBA as JPEG

This commit is contained in:
Vadim committed 2024-05-01 00:27:37 +02:00
1 parent 9d00ed2f93
commit fe95438da9
2 files changed
+35 -3

No files matched your search

+1
View File
@@ -63,6 +63,7 @@ def download_and_convert_thumbnail(ydl_opts, url: str, clear_filename: str, outp
response = ydl.urlopen(thumbnail_url)
image_data = response.read()
image = Image.open(io.BytesIO(image_data))
image = image.convert('RGB') # Convert to RGB to avoid transparency or RGBA issues
image_path = os.path.join(output_path, clear_filename + " [CO].jpg")
image.save(image_path, "JPEG")
crop_image_to_square(image_path)