Friday, December 1, 2017

pretty titles (and cats) in your terminal!

A little-known feature of iTerm2 is that you can insert images directly into your (previously text only) terminal!  This can be useful (render calculation as plot directly in terminal) or we can use it for silly purposes.

Cats. Who on the interwebs doesn't love cats?


brew install imagemagick
copy iTerm2's imgcat script into your path

Test: display built-in image

convert rose: - | imgcat /dev/stdin

Pretty Title

convert -background lightblue -fill blue  -font Tahoma -size 165x70  label:Anthony    z.png && imgcat z.png

Good Job, Bub!

curl -s | imgcat /dev/stdin

Note the "Tahoma" font used above is probably only on macOS.  Choose another font that's installed into ImageMagick.  What fonts are those, you say?  Here you go:

List ImageMagick Fonts (Awk FTW)

$ convert -list font | awk '/Font:/ {print $2} {next}' | pr -4t
AndaleMono   BigCaslonM     Herculanum      TimesNewRomanBI
AppleChancery   BrushScriptI     HoeflerTextOrname TimesNewRomanI
AppleMyungjo   Chalkduster     Impact       Trebuchet
Arial   ComicSans     InaiMathi       TrebuchetMSB
ArialB   ComicSansMSB     Kokonor       TrebuchetMSBI
ArialBI   CourierNew     Krungthep       TrebuchetMSI
ArialBk   CourierNewB     MicrosoftSansSeri Verdana
ArialI   CourierNewBI     PlantagenetCherok VerdanaB
ArialNarrow   CourierNewI     Sathu       VerdanaBI
ArialNarrowB   GB18030Bitmap     Silom       VerdanaI
ArialNarrowBI   Georgia     Skia       Webdings
ArialNarrowI   GeorgiaB     Tahoma       Wingdings
ArialRoundedB   GeorgiaBI     TahomaB       Wingdings2
ArialUnicode   GeorgiaI     TimesNewRoman     Wingdings3
Ayuthaya   Gurmukhi     TimesNewRomanB    Zapfino