WIP GIF support
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user