-
Notifications
You must be signed in to change notification settings - Fork 10
How to Work with Images
You can use your own images in a Learning Lab by uploading them to a folder /assets/images
, one per Lab. Then reference the image in your Markdown file with a relative path, such as ![alt tab](assets/images/filename.png)
.
As for image file types, we prefer PNG but animated GIFs are also allowed.
We've found that asciinema saves files in .cast
and then you can use asciicast2gif within a Docker container to do the conversion to GIF.
asciinema lets you easily record terminal sessions and replay them in a terminal as well as in a web browser.
Install latest version:
sudo pip3 install asciinema
Record your first session:
asciinema rec first.cast
Now replay it with double speed:
asciinema play -s 2 first.cast
Or with normal speed but with idle time limited to 2 seconds:
asciinema play -i 2 first.cast
You can pass -i 2 to asciinema rec as well, to set it permanently on a recording. Idle time limiting makes the recordings much more interesting to watch. Try it.
If you want to watch and share it on the web, upload it:
asciinema upload first.cast
Pull the image:
docker pull asciinema/asciicast2gif
Use it like this:
docker run --rm -v $PWD:/data asciinema/asciicast2gif [options and arguments...]
You need to mount some local directory at /data so input and output files can be accessed by the container. Mounting current working directory ($PWD) makes most sense in majority of cases.
For example, generating GIF from local file, with double speed and Solarized theme:
docker run --rm -v $PWD:/data asciinema/asciicast2gif -s 2 -t solarized-dark 216176.cast demo.gif
Running the above, long command can get old very quickly. Creating a shell alias may be a good idea:
alias asciicast2gif='docker run --rm -v $PWD:/data asciinema/asciicast2gif'
COPYRIGHT © 2019-2021 CISCO SYSTEMS, INC. ALL RIGHTS RESERVED.