From 344da0a0bf8cdfaea474d8999a7cbfddee09a350 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 22 May 2024 15:20:26 +0200 Subject: [PATCH] fix: converting pictures to rgb before saving --- music_kraken/audio/metadata.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/music_kraken/audio/metadata.py b/music_kraken/audio/metadata.py index d3f450e..bceb775 100644 --- a/music_kraken/audio/metadata.py +++ b/music_kraken/audio/metadata.py @@ -93,6 +93,10 @@ def write_metadata_to_target(metadata: Metadata, target: Target, song: Song): # resize the image to the preferred resolution img.thumbnail((main_settings["preferred_artwork_resolution"], main_settings["preferred_artwork_resolution"])) + # https://stackoverflow.com/a/59476938/16804841 + if img.mode != 'RGB': + img = img.convert('RGB') + img.save(converted_target.file_path, "JPEG") # https://stackoverflow.com/questions/70228440/mutagen-how-can-i-correctly-embed-album-art-into-mp3-file-so-that-i-can-see-t