More reliance on GLib

This commit is contained in:
kramo
2023-04-17 19:20:29 +02:00
parent 297bea8494
commit bc0d33f966
4 changed files with 31 additions and 37 deletions

View File

@@ -26,6 +26,9 @@ from PIL import Image, ImageSequence
def resize_cover(win, cover_path=None, pixbuf=None):
if not cover_path and not pixbuf:
return
if pixbuf:
cover_path = Path(Gio.File.new_tmp("XXXXXX.tiff")[0].get_path())
pixbuf.savev(str(cover_path), "tiff", ["compression"], ["1"])
@@ -48,7 +51,6 @@ def resize_cover(win, cover_path=None, pixbuf=None):
# This might not be necessary in the future
# https://github.com/python-pillow/Pillow/issues/2663
if image.mode not in ("RGB", "RGBA"):
print(image.mode)
image = image.convert("RGBA")
tmp_path = Path(Gio.File.new_tmp("XXXXXX.tiff")[0].get_path())