Skip to content Skip to sidebar Skip to footer

Scaling Up An Animated GIF In Python To Be Used With PyGTK

I have this little python script which opens up a window and puts an animated GIF inside the window. I'm using it as a screensaver (nothing fancy, really). My problem is that the

Solution 1:

logically you can use

GdkPixbuf.Pixbuf.scale_simple ()

on all the GdkPixbuf contains within GdkPixbuf.PixbufAnimation. How to get the single GdkPixbuf.Pixbuf? Use the iter to walk through GdkPixbuf.PixbufAnimation. first iter would be

iter = GdkPixbuf.PixbufAnimation.get_iter (GLib.get_current_time() )
pbuf = iter.get_pixbuf ()
# scale the pbuf below
......
# make this on a loop
iter = iter.advance (GLib.get_current_time())

# after getting all the pbuf, pack again into GdkPixbuf.PixbufSimpleAnim
simpleanim = GdkPixbuf.PixbufSimpleAnim (width, height, rate)
# loop again
simpleanim.add_frame (pbuf)

# after done all the chores, call the
Gtk.Image.set_from_animation (simpleanim) #simpleanim implemented anim

Post a Comment for "Scaling Up An Animated GIF In Python To Be Used With PyGTK"