TotallyNotChase / glitch-this

:camera: Glitchify images and GIF - with highly customizable options!
MIT License
1.76k stars 63 forks source link

KeyError : 'duration' #32

Closed owocado closed 3 years ago

owocado commented 3 years ago

Hi, The glitch_this command works well with most gifs, but it is particularly throwing error with this gif: Discord Avatar

The error:

root:~ # glitch_this ./avatar.gif -g -ig 2
Traceback (most recent call last):
  File "/usr/local/bin/glitch_this", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/glitch_this/commandline.py", line 176, in main
    step=args.step)
  File "/usr/local/lib/python3.7/dist-packages/glitch_this/glitch_this.py", line 330, in glitch_gif
    duration += frame.info['duration']
KeyError: 'duration'
TotallyNotChase commented 3 years ago

It seems like PIL/pillow can't extract the duration info from each frame on this gif. Unfortunately, there are some gifs that don't provide all the information required to PIL/pillow

owocado commented 3 years ago

Any way you can catch the exception to make error message user friendly? 🙂

TotallyNotChase commented 3 years ago

Sure, updated to 1.0.1