Skip to content

Conversation

martinRenou
Copy link
Collaborator

This PR makes saving frames more reliable (fix https://github.com/martinRenou/ipycanvas/issues/222), allowing to implement a save_gif method (fix https://github.com/martinRenou/ipycanvas/issues/136)

from time import sleep

# 50Hz
frequency = 20

with save_gif(canvas, "test.gif", frequency=frequency):
    for i in range(50):
        canvas.clear()

        draw(canvas, i * frequency)

        canvas.frame()

TODO

  • Implement a save_video using OpenCV (as an optional dependency)
  • Add docs for this
  • Update the docs for saving files: using frame instead of sync_image_data
  • Remove docs for sync_image_data and deprecate it? We should probably encourage manual syncing from now on
  • Update self.data when a frame is received

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

Successfully merging this pull request may close these issues.

to_file is unreliable Add a method for easily generating GIFs
1 participant