Skip to content

AttributeError: 'numpy.ndarray' object has no attribute 'tobytes' #499

@Vadimrozov

Description

@Vadimrozov

I have issue with write_gif function from basic example.

[MoviePy] Building file circle.gif with imageio
  0%|          | 0/31 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Users/vadimrozov/PycharmProjects/vector_art/main.py", line 12, in <module>
    clip.write_gif("circle.gif",fps=15)
  File "<decorator-gen-56>", line 2, in write_gif
  File "/Library/Python/2.7/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-55>", line 2, in write_gif
  File "/Library/Python/2.7/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "/Library/Python/2.7/site-packages/moviepy/video/VideoClip.py", line 461, in write_gif
    verbose=verbose, colors=colors)
  File "/Library/Python/2.7/site-packages/moviepy/video/io/gif_writers.py", line 291, in write_gif_with_image_io
    writer.append_data(frame)
  File "/Library/Python/2.7/site-packages/imageio/core/format.py", line 481, in append_data
    return self._append_data(im, total_meta)
  File "/Library/Python/2.7/site-packages/imageio/plugins/pillowmulti.py", line 101, in _append_data
    self._writer.add_image(im, duration, dispose)
  File "/Library/Python/2.7/site-packages/imageio/plugins/pillowmulti.py", line 146, in add_image
    self.opt_palette_size)
  File "/Library/Python/2.7/site-packages/imageio/plugins/pillowmulti.py", line 332, in converToPIL
    im_pil = ndarray_to_pil(im, 'gif')
  File "/Library/Python/2.7/site-packages/imageio/plugins/pillow.py", line 483, in ndarray_to_pil
    array_buffer = arr.tobytes()
AttributeError: 'numpy.ndarray' object has no attribute 'tobytes'

Python 2.7.1
FFmpeg 3.2.4

I have no clue how to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions