Search code examples
pythontmuxasciimatics

asciimatics - how to export to a GIF?


I'm new to asciimatics and would like to export animations I'm making to a GIF, at the command line. Note that I want to ONLY record the animation itself, not me starting some command in the terminal to record the gif as well.

I've looked at the docs, but don't see an asciimatics way to do this?

Note that I'm aware of things like ttygif, but tried to use it and couldn't get it to work with asciimatics, probably due to me not understanding how to use it.


Solution

  • You can do this using toughtty - it allows you to control when the recording starts, which works great for staring the recording manually.

    My use case is generating fun gifs to paste into Slack that are branded with lol animations and text ;-) So I don't want anyone to actually see it was a terminal window at all, just a retro looking animation that I made super fast!

    So in summary:

    • get your animation ready to record
    • start the recorder, toughtty by running $ toughtty record frames.json
    • start your animation. Note that recording hasn't started yet.
    • once your animation is running, press Ctrl+T to start recording
    • when you think it's good, press Ctr+C to stop the recording
    • generate your gif by running toughtty encode --delay 100 out.json test.gif
    • open the test.gif in your browser to view the animation!

    I found toughtty by browsing the active forks of ttystudio https://techgaun.github.io/active-forks/index.html#chjj/ttystudio

    and then installed it under node v8

    Example: https://i.sstatic.net/lNZvT.jpg