Skip to content

Commit

Permalink
Fix issue with CMYK images
Browse files Browse the repository at this point in the history
Previously, if a CMYK cover image were encountered, the update would
fail because the color space was not being handled correctly.
  • Loading branch information
pganssle committed Feb 7, 2025
1 parent c476766 commit a061035
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/audio_feeder/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,9 @@ def _generate_thumbnail(img_loc: PathType, thumb_loc: PathType) -> None:
# Don't upscale it
scale = min([scale, 1])

if img.mode != "RGB":
img = img.convert("RGB")

img.thumbnail((w * scale, h * scale))
img.save(thumb_loc)

Expand Down
1 change: 0 additions & 1 deletion tests/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def patch_book_updater() -> typing.Iterator[None]:
updater.BookDatabaseUpdater = old_book_updater


@pytest.mark.xfail
def test_update_books(testgen_config: pathlib.Path) -> None:
with patch_book_updater():
updater.update(content_type="books")

0 comments on commit a061035

Please sign in to comment.