I’ve been thinking about the DS106 experience recently due to my marginal involvement in the combobulating experience. This was very much focused on The Daily Create, a bit of fun I dip into occasionally. One of the things that I thought about was the fact I often got more fun out of the DS106 assignment bank than the daily tasks. Today Alan’s post reminded me why. It made me dig into this post, notes for which were sitting the my drafts app, spiff it up a bit and post it.
The other day I saw the #tdc5055 #ds106 ASCII Art on The Daily Create
Use the ASCII Art Paint site to create something interesting with the thematic symbols.
It immediately reminded me of figlet. Took me a couple of minutes to remember the name.
Figlet makes big ASCII text on the command line. You just type in “figlet “#DS106” and you get something like this in the terminal:
_____ _
|_ _|__ ___| |_
| |/ _ \/ __| __|
| | __/\__ \ |_
|_|\___||___/\__|
You can try figlet out online if you don’t want to use the terminal and install it: Asciified
asciified is a small webapp that gives you the ability to create figlets using the figlet package
I had a dim memory that figlet had the concept of “fonts” so checked the help. The fonts were stored in a folder. As there didn’t seem to be an easy way to preview them, I thought I’d just write a script. This would loop through all the fonts I’d copied to a text file, and allow me to pick the best version.
while IFS= read -r font; do
figlet -f "$font" -c -S "Daily Create"
sleep 0.5
done < figfonts.txt
Watching them scroll past then made me think a screen recording might be interesting. I cleaned up the list of fonts1 a little and recorded my window, posted it to YouTube and replied to @creating. Job done2.
The next day I wondered if I could do a better job of this: automate the screen capture by grabbing screenshots and then taking them and stringing them together to make a “video” with ffmpeg. And indeed I could.
#!/usr/bin/env bash
WINID=$(osascript -e 'tell application "Terminal" to id of front window')
screencapture -l $WINID -o 0000.png >/dev/null 2>&1
while IFS= read -r font; do
pngfile=$(printf "%04d.png")
figlet -f "$font" -c -S "Daily Create"
screencapture -l $WINID -o $pngfile >/dev/null 2>&1
sips --resampleWidth 1200 $pngfile >/dev/null 2>&1
done < figfonts.txt
ffmpeg -framerate 5 -i %04d.png -c:v libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -r 24 -pix_fmt yuv420p figfontfun.mp4
screencapture can capture just a window if you give it a Window ID. A search showed me how to get that. sips resizes the images. I sent the output off screen with >/dev/null 2>&1. Taking a screenshot of the window without shadow, the -o bit, made for neater images.
The loop give me a bunch of png files which are concatenated into a video. I’ve done that a few times. Unfortunately I don’t use ffmpeg enough to get that right the first time. Video codec and many ffmpeg paramaters seem very complicated. Again a few searches put me right3. And I had a short script that would work.
Here is the result:
I am still not sure why writing up this post, trying to put a rather silly idea in order, is satisfying. But it was.
- I just copied out the list of items in the figlet font folder to a text file, removed folder and then file names that didn’t work. I am sure a smarter script could do that without the manual clean up. ↩︎
- When I say job done I mean footering about for an hour or two with figlet, and QuickTime Player to record the screen. ↩︎
- FFMPEG solutions are very searchable. NTS: the bit about rounding sizes to even numbers has bitten me before. Hopefully this footnote will help me remember that the next time. ↩︎
