Megabound / dither-shitter

Tools for dithering
17 stars 0 forks source link

Processing gifs: "The keyword `fps` is no longer supported. Use `duration`(in ms) instead" #2

Open timbennett opened 2 weeks ago

timbennett commented 2 weeks ago

Description: Processing an animated gif results in the error in the title.

Python version: 3.9.13

Steps to reproduce:

  1. Download an animated gif, e.g. Rotating Earth
  2. python dither.py and select the downloaded file
  3. Traceback:
Processing frame  1
[trimmed]
Processing frame  42
Saving GIF file
Traceback (most recent call last):
  File "C:\dither-shitter-main\dither.py", line 89, in <module>
    processVideo(fullpath)
  File "C:\dither-shitter-main\dither.py", line 60, in processVideo
    io.mimsave(os.path.join(directory, '_g' + str(CHUNKSIZE) + filename), output, loop=0, fps = framesPerSecond)
  File "C:\Users\Me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\imageio\v2.py", line 495, in mimwrite
    return file.write(ims, is_batch=True, **kwargs)
  File "C:\Users\Me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\imageio\plugins\pillow.py", line 383, in write
    raise TypeError(
TypeError: The keyword `fps` is no longer supported. Use `duration`(in ms) instead, e.g. `fps=50` == `duration=20` (1000 * 1/50).

Relevant line:

https://github.com/Megabound/dither-shitter/blob/58dde6dea9708360832d226370d28bd0e99b42c1/dither.py#L60

timbennett commented 2 weeks ago

Suggested fix for line 60:

io.mimsave(os.path.join(directory, '_g' + str(CHUNKSIZE) + filename), output, loop=0, duration = 1000 * 1/framesPerSecond)

Appears to work for me.