Confused Gif from Tenor GIF site
“Gif for CLI… What?!”

The command line is fantastically versatile.

You can get weather forecasts on the CLI, you can get the latest World Cup scores on the CLI, and you can even watch Star Wars on the CLI.

And now, thanks to a Google employee, you can view GIFs on the command line.

—Say what?!

View Animated Gifs on the CLI

gif for cli
A gif displayed at the CLI

Not going to lie: there’s a great satisfaction in deploying a well-timed GIF as a mic-drop moment or snark-tastic comeback.

But while these pithy animated clips make sense on service like WhatsApp, Telegram, Twitter and Reddit, is the humble terminal sorely in need of them?

Debatable, but a Google dev has gone and done it anyway, releasing GIF for CLI to celebrate the 31st anniversary of the Gif.

How does the tool work? How is it possible to get colorful rich animations display in the terminal?

I’ll let the big G explain:

“The command line program […] takes the chosen .gif file (file, url, or Tenor query) and uses ffmpeg to split the animated gif or short video into static jpg frames. Those jpg frames are then converted to ASCII art (these ASCII art frames are cached in $HOME/.cache/gif-for-cli).

The program then prints one frame at a time to the console, clearing the console using ANSI escape sequences between each frame.”

The GIF to CLI tool:

  • Converts GIF to ASCII
  • Plays animated GIFs on the command line
  • Supports up to 256 colors
  • Provides options to adjust size
  • Lets you save ASCII gifs to share online
https://thumbs.gfycat.com/AggressiveLeanArcticwolf-size_restricted.gif
I dig it

It also lets you search Gif sharing site Tenor to find relevant clips, or fetch a specific one should you know it’s URL ID.

The script automatically detects how many colours your existing terminal emulator is using, displaying an appropriate image based on these results.

So, depending on your set up, you could see a (somewhat) colourful ASCII rendition of your favourite reaction gif slap bang in the middle of your terminal — nice!

For more details, and full instructions on how to install the dang tool on your system, head over to the official GitHub repo though do note (as pointed out in the comments) that the tool is not supported by Google.

GIF for CLI on GitHub

Thanks Tim

Gif Google terminal apps