pyglet cannot decode animated gif in 1.4.8 but in 1.4.0b1 there was no problem??

120 views
Skip to first unread message

Volker Süß

unread,
Dec 7, 2019, 4:58:56 AM12/7/19
to pyglet-users
Hello!

I installed my little slide_show script on an new computer and found that it is broken for

animation = pyglet.image.load_animation(fn)

I got an execption:

raise ImageDecodeException('This decoder cannot decode animations.')
pyglet
.image.codecs.ImageDecodeException: This decoder cannot decode animations.

I the 1.4.0b1 I have no problems with this.

Where is the change??

Volker Süß

unread,
Dec 7, 2019, 7:19:00 AM12/7/19
to pyglet-users
Further investigations have shown that pyglet is not the causer. It looks like gdkpixbuf2 is the problem.. But I'm not sure at this time.

Volker Süß

unread,
Dec 8, 2019, 3:42:52 AM12/8/19
to pyglet-users
It seems that in ubuntu 19.10 something was changed. In ubuntu 18.04 I have no problem to load the animated gif - in 19.10 I got the error.

I have attached the example files to test this.

Anone an idea??
anigif.py
source.gif

claudio canepa

unread,
Dec 8, 2019, 2:25:21 PM12/8/19
to pyglet...@googlegroups.com
pyglet has some included decoders, but it can use PIL / pillow to decode more formats or to load faster.
Maybe the one functioning has pillow installed and the other not? 

Also, in my pyglet copy which is somewhat recent I don't found the line "raise ImageDecodeException('This decoder cannot decode animations.')". Are you sure your script is importing the correct (newer) pyglet version?



--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyglet-users/0ee23a03-3820-422b-b4e3-6e7c70c04e69%40googlegroups.com.

Volker Süß

unread,
Dec 8, 2019, 3:20:24 PM12/8/19
to pyglet-users
the exception;

 File "/home/vsuess/git/pyglet/examples/anigif.py", line 4, in <module>
    ani
= pyglet.image.load_animation('25129.gif')
 
File "/home/vsuess/.local/lib/python3.7/site-packages/pyglet/image/__init__.py", line 251, in load_animation
   
raise first_exception
 
File "/home/vsuess/.local/lib/python3.7/site-packages/pyglet/image/__init__.py", line 243, in load_animation
    image
= decoder.decode_animation(file, filename)
 
File "/home/vsuess/.local/lib/python3.7/site-packages/pyglet/image/codecs/__init__.py", line 100, in decode_animation
   
raise ImageDecodeException('This decoder cannot decode animations.')

Volker Süß

unread,
Dec 8, 2019, 3:29:20 PM12/8/19
to pyglet-users
on ubuntu 19.10 :

python-pil:amd64                           6.1.0-1                                amd64        Python Imaging Library (Pillow fork)


on ubuntu 18.04:

python-pil:amd64                           5.1.0-1                                amd64        Python Imaging Library (Pillow fork)

claudio canepa

unread,
Dec 8, 2019, 5:51:43 PM12/8/19
to pyglet...@googlegroups.com
Sorry for the misinformation, looking at pyglet.image.codecs.pil it follows that loading animations with pil is not supported (no method  decode_animation in the decoder) so it should come from other decoder.

In windows animations loads from codecs\gdiplus , i guess in linux loads from codecs/gdkpixbuf2 ; you can confirm that by commenting out in codecs.__init__ the block

    # Linux default: GdkPixbuf 2.0
    if compat_platform.startswith('linux'):
        try:
            from pyglet.image.codecs import gdkpixbuf2
            add_encoders(gdkpixbuf2)
            add_decoders(gdkpixbuf2)
        except ImportError:
            pass

and run your test in the machine where it was working; now it should not work.

At least you can confirm if the problem comes from  gdkpixbuf2



--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.

Benjamin Moran

unread,
Dec 8, 2019, 9:02:09 PM12/8/19
to pyglet-users
I replied to your issue on Github. Looks like maybe GTKPixbuf2 is no longer installed by default on Ubuntu 19.10?
It looks like that's the only decoder in pyglet that can handle gif files at the moment. 

Benjamin Moran

unread,
Dec 9, 2019, 4:13:10 AM12/9/19
to pyglet-users
Ubuntu 19.04+, you need to manually install the 

In addition, I added support for loading animated GIFs to the PIL/Pillow image codec. This will be out in the next v1.4.9 release.
If anyone wants to test it, it's the pyglet-1.4-maintenance branch.

To install via pip, this command should work:
pip install --upgrade --user git+https://github.com/pyglet/pygle...@pyglet-1.4-maintenance

Benjamin Moran

unread,
Dec 9, 2019, 4:14:41 AM12/9/19
to pyglet-users
I meant to type: 

"In Ubuntu 19.04+, you need to manually install the libgtk2.0-0 package."


On Monday, December 9, 2019 at 6:13:10 PM UTC+9, Benjamin Moran wrote:
Ubuntu 19.04+, you need to manually install the 

In addition, I added support for loading animated GIFs to the PIL/Pillow image codec. This will be out in the next v1.4.9 release.
If anyone wants to test it, it's the pyglet-1.4-maintenance branch.

To install via pip, this command should work:

Volker Süß

unread,
Dec 9, 2019, 6:55:02 AM12/9/19
to pyglet-users
Okay, I will try this!
Reply all
Reply to author
Forward
0 new messages