WIP GIF support

This commit is contained in:
2023-04-27 17:57:23 -05:00
parent 0259727784
commit 599d1f5145
4 changed files with 32 additions and 28 deletions

View File

@@ -66,10 +66,14 @@ class Image(Gtk.EventBox):
if PImage and path.endswith(".webp"):
return self.image2pixbuf(path, w, h)
try:
pixbuf = Gtk.Image.new_from_file(path).get_pixbuf()
except Exception:
pixbuf = Gtk.Image.new_from_resource(path).get_pixbuf()
if path.endswith(".gif"):
pixbuf = GdkPixbuf.PixbufAnimation.new_from_file(path).get_static_image()
if not pixbuf:
try:
pixbuf = Gtk.Image.new_from_file(path).get_pixbuf()
except Exception:
pixbuf = Gtk.Image.new_from_resource(path).get_pixbuf()
return pixbuf.scale_simple(w, h, 2) # 2 = BILINEAR and is best by default