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

Pillow 3.0.0 drops support for tostring() in favour of tobytes() #241

Closed
natfarleydev opened this issue Dec 22, 2015 · 2 comments
Closed

Comments

@natfarleydev
Copy link

Using the most up to date Pillow (3.0.0), using VideoFileClips resize method fails with the following traceback (only relevant bit shown):

  File "/home/nasfarley88/thebslparlour/bslparloursite/helper/gif.py", line 38, in process_video
    video_file = video_file.resize(width=max_width)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/video/fx/resize.py", line 144, in resize
    newclip = clip.fl_image(fl)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/video/VideoClip.py", line 514, in fl_image
    return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/Clip.py", line 136, in fl
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "<decorator-gen-57>", line 2, in set_make_frame
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/decorators.py", line 14, in outplace
    f(newclip, *a, **k)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/video/VideoClip.py", line 654, in set_make_frame
    self.size = self.get_frame(0).shape[:2][::-1]
  File "<decorator-gen-14>", line 2, in get_frame
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/Clip.py", line 95, in get_frame
    return self.make_frame(t)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/Clip.py", line 136, in <lambda>
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/video/VideoClip.py", line 514, in <lambda>
    return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/video/fx/resize.py", line 142, in <lambda>
    fl = lambda pic: resizer(pic.astype('uint8'), newsize)
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/moviepy/video/fx/resize.py", line 32, in resizer
    arr = np.fromstring(resized_pil.tostring(), dtype='uint8')
  File "/home/nasfarley88/thebslparlour/env/lib/python3.4/site-packages/PIL/Image.py", line 686, in tostring
    "Please call tobytes() instead.")
Exception: tostring() has been removed. Please call tobytes() instead.
@diakonovm
Copy link

Take a look at the latest build. The relevant lines are comment out. If you follow the trace this error occurs at line 32 in resize.py. You can change that to use tobytes() or update the file to the latest file in master. This solved the problem related to the resizing issue I had.

@natfarleydev
Copy link
Author

Changing resize.py works for now without issue. I'll wait until the next release to upgrade my moviepy to keep my pip environment clean but I'm sure it'll work.

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

2 participants