d0c-s4vage / lookatme

An interactive, terminal-based markdown presenter
https://lookatme.readthedocs.io/en/latest/
MIT License
2.06k stars 59 forks source link

3.0 - screenshot/gif of lookatme slides via selenium/html output #203

Closed d0c-s4vage closed 1 year ago

d0c-s4vage commented 1 year ago

Describe the Feature Request ' A screenshot utility script should exist in bin/ that is part of the development tools for lookatme. It should be able to take slides and a series of keystrokes, and render a gif of the slides in action.

E.g.

bin/lookatme-screenshot test.md -o slides.gif --gif --keys scroll_down:3,j:1.5,j:1.5,j:1.5 --width X --height Y

This should scroll to the bottom of the first slide over three seconds, and press "j" (or next slide") with a 1.5s delay in between.

Additional notes

One approach:

  1. Create presentation from markdown source
  2. Generate canvases after each keystroke
  3. Convert each canvas to raw html
  4. Load each html into chrome via selenium, with browser width/height set to the provided width/height
  5. Save screenshot of each html into a folder
  6. Create a gif with provided delays from the screenshots (maybe using ImageMagick's convert?)