Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy update might have broken the gif making command #20

Open
kboruff opened this issue Apr 23, 2017 · 3 comments
Open

Numpy update might have broken the gif making command #20

kboruff opened this issue Apr 23, 2017 · 3 comments

Comments

@kboruff
Copy link

kboruff commented Apr 23, 2017

Using the gif argument now returns "Error: only integer scalar arrays can be converted to a scalar index"

This might be something to do with how Numpy is handling np.float32 now.

@nickbclifford
Copy link

The error is on this line. Has anyone found any workarounds for this? I tried adding [0] to each of the slices, but that created a .gif that was not viewable for me.

@Benitoite
Copy link

@kboruff @nickbclifford @kesara
A fix for that lifted from https://github.com/lucyking/images2gif-Pillow/blob/master/images2gif/images2gif.py

@@ -340,17 +338,17 @@ class GifWriter:
             Y = np.argwhere(diff.sum(1))
             # Get rect coordinates
             if X.size and Y.size:
-                x0, x1 = X[0], X[-1] + 1
-                y0, y1 = Y[0], Y[-1] + 1
+                x0, x1 = int(X[0]), int(X[-1] + 1)
+                y0, y1 = int(Y[0]), int(Y[-1] + 1)
             else:  # No change ... make it minimal
                 x0, x1 = 0, 2
                 y0, y1 = 0, 2

This deals with the scalar integer error, but then I got a new error.

Creating gif...
Error: a bytes-like object is required, not 'str'

Don't know what causes that one.

@uajqq
Copy link

uajqq commented Nov 28, 2020

For anyone else who finds this while troubleshooting: my quick-and-dirty solution was just to do away with images2gif entirely, and use Pillow to make the gifs. Large filesizes, but it works. You can check out my fork for details (and other improvements like progress bars).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants