-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.GIF
Description
What did you do?
Load a GIF and attempted to save each frame to a file
What did you expect to happen?
Each frame of the gif is saved to a different image file in a directory
What actually happened?
The loop errored before completion
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/discord/ext/commands/core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "/root/discord/mods/Fun.py", line 313, in gmagik
for image in glob.glob(gif_dir+"*_{0}.png".format(rand)):
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/root/discord/mods/Fun.py", line 232, in do_gmagik
try:
File "/usr/local/lib/python3.6/site-packages/PIL/Image.py", line 1698, in save
self.load()
File "/usr/local/lib/python3.6/site-packages/PIL/ImageFile.py", line 242, in load
if not self.map and not LOAD_TRUNCATED_IMAGES and err_code < 0:
UnboundLocalError: local variable 'err_code' referenced before assignmentWhat versions of Pillow and Python are you using?
Latest PIL from PyPy, Python 3.6
Replicated just using PIL from repl.
try:
frame = PIL.Image.open(gif)
except:
return '\N{WARNING SIGN} Invalid Gif.'
if frame.size >= (3000, 3000):
os.remove(gif)
return '\N{WARNING SIGN} `GIF resolution exceeds maximum >= (3000, 3000).`'
count = 0
while frame:
frame.save('{0}{1}_{2}.png'.format(gif_dir, count, rand), 'GIF')
count += 1
try:
frame.seek(count)
except EOFError:
breakGIF In question: https://cdn.discordapp.com/attachments/272432272949510144/275311320017010709/gmagik.gif (can give more samples if needed)
Metadata
Metadata
Assignees
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.GIF