Skip to content

zsoltf/gotermimg

 
 

Repository files navigation

gotermimg

Build Status

Something hacked together to display images and play gifs in 256 color terminals. I have implemented something similar before , as have others...

Wrote this largely as an exercise in Go.

Installation

Install using go get:

go get github.com/moshen/gotermimg/...

Installs the gotermimg and gogopher command line applications.

Usage

gotermimg

Usage: gotermimg [-u] [-x=n] [-y=n] [-l=n|-s=n] [IMAGEFILE]
  IMAGEFILE - png, gif or jpg.  gif will auto-play.
  Image data can be piped to stdin instead of providing IMAGEFILE.

  If neither -x or -y are provided, and the image is larger than your current
  terminal, it will be automatically scaled to fit.

  -l=0: Loop animation n times
        When -l=0 (the default), animation is looped indefinitely. Supersedes -s
        Only applies to multi-frame gifs
  -s=0: Loop animation n seconds
        When -s=0 (the default), this option is ignored.
        Only applies to multi-frame gifs
  -u=false: Enable UTF8 output
  -x=0: Scale to n*2 columns wide in ANSI mode, n columns wide in UTF8 mode.
        When -x=0 (the default), aspect ratio is maintained.
        For example if -y is provided without -x, width is scaled to
        maintain aspect ratio
  -y=0: Scale to n rows high in ANSI mode, n/2 rows high in UTF8 mode.
        When -y=0 (the default), aspect ratio is maintained.
        For example if -x is provided without -y, height is scaled to
        maintain aspect ratio

gotermimg on a png with transparency

gotermimg on an animated gif with transparency

While the render speed on some slower terminals might not look very good, urxvt looks amazing (click through for HQ).

gotermimg on urxvt

Get a shifty gopher:

curl http://zippy.gfycat.com/FlippantAccurateHaddock.gif | gotermimg

Author

Colin Kennedy

vendor/gif

Go AUTHORS

vendor/resize

Jan Schlicht

vendor/termutil

Andrew

License

MIT (unless otherwise noted), See LICENSE file

The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/) The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: http://blog.golang.org/gopher

vendor/gif

BSD

vendor/resize

MIT Style

vendor/termutil

MIT

About

Display images and play gifs in your 256 color terminal!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.1%
  • Makefile 1.9%