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

Implement save_gif function #301

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Implement save_gif function #301

wants to merge 6 commits into from

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