gdk_pixbuf_new_from_file_at_scale is broken for animated GIFs
Submitted by Will Greenberg
Link to original bug (#735422)
Description
If an animated gif is loaded via gdk_pixbuf_new_from_file_at_scale()
, GdkPixbuf throws "GIF image was truncated or incomplete".
This happens seemingly independent of the scale provided, and would appear to be because the GdkPixbufLoader
for the gif is being closed before the gif has been fully read (i.e. its state is GIF_LZW_FILL_BUFFER
at Loader closing time). Perhaps the check for an existing animation at gdk-pixbuf/gdk-pixbuf-io.c:L1361 isn't a reliable tell for when the image is ready to be closed?
Here's a tiny script to reproduce. Sample image is SFW adorable cat gif:
$ curl http://i.imgur.com/psu515W.gif -o catbee.gif
$ gjs -c "imports.gi.GdkPixbuf.Pixbuf.new_from_file_at_scale('catbee.gif', -1, -1, true);"
Version: git master
Depends on
Edited by Emmanuele Bassi