Cute Animal Pictures in my Terminal

I wanted cute pictures of my gecko in my terminal. I already had a tool — echo-with-colours fittingly named gecko — that prints gecko ascii-art when I open my terminal.

a small asciiart gecko

But I wanted something better; random cute images of my pet converted to text. I used the open source tool catimg to convert pet-pictures to unicode representations using a simple script

#!/bin/env sh

encode_gecko () {
  folder="$1"

  if [ -z "$folder" ]; then
    echo '[you must provide gecko pictures]'
    return 1
  fi

  mkdir -p .dotfile_data/gecko
  for file in $(fdfind . "$1" ); do
    hash=$(echo "$file" | md5sum)
    catimg "$file" -H 40 > ".dotfile_data/gecko/$hash"
  done
}

and catimg to print out the saved images at random on terminal load (by sourcing it in .zshrc)

show_gecko () {
  cat "$(fdfind . "$HOME/.dotfile_data/gecko" | shuf -n 1)"
}

The final results are very cute, if you like geckos!

my gecko in a tophat

Takeaway Points: