Always resize images

This commit is contained in:
kramo
2023-04-11 17:06:35 +02:00
parent dc9a91eac3
commit fd9e0511d0
2 changed files with 8 additions and 4 deletions

View File

@@ -24,9 +24,9 @@ import time
from gi.repository import Adw, Gio, GLib, GObject, Gtk
from .game_cover import GameCover
from .create_dialog import create_dialog
from .save_cover import save_cover
from .game_cover import GameCover
from .save_cover import resize_animation, save_cover
from .save_game import save_game
from .steamgriddb import SGDBSave
@@ -229,7 +229,11 @@ def create_details_window(parent_widget, game_id=None):
cover_button_delete_revealer.set_reveal_child(True)
cover_deleted = True
game_cover.new_pixbuf(path=path)
game_cover.new_pixbuf(
path=resize_animation(path)
if str(path).rsplit(".", maxsplit=1)[-1] == "gif"
else path
)
def close_window(_widget, _callback=None):
window.close()

View File

@@ -31,7 +31,7 @@ def resize_animation(cover_path):
frame.copy().resize((200, 300)) for frame in ImageSequence.Iterator(image)
)
tmp_path = Path(Gio.File.new_tmp(None)[0].get_path())
tmp_path = Path(Gio.File.new_tmp("XXXXXX.gif")[0].get_path())
frames[0].save(
tmp_path,
format="gif",