Giter Site home page Giter Site logo

img2ansi's Introduction

img2ansi

Renders raster images for a terminal using ANSI color codes. Supported image types are JPEG, PNG, and GIF (which may be animated).

img2ansi motd.png
img2ansi -animate -repeat=5 -scale https://i.imgur.com/872FDBm.gif
img2ansi -h

Image converter based on @saikobee's nifty tool

Install

go get github.com/bmatsuo/img2ansi

NOTE: Windows is not supported.

Documentation

On godoc.org

Unix friendly

img2ansi is built to work with streams and can operate on standard input. So, while it natively supports GET requests against HTTP URLs you can pipe data in from curl, netcat, or whatever else.

curl https://i.imgur.com/872FDBm.gif | img2ansi -animate -width=80 -repeat=5
netcat -lp 8000 | img2ansi -animate -width=80

Saving images

The output of img2ansi can be redirected to a file and replayed later using cat.

img2ansi -animate -width=80 -repeat=5 https://i.imgur.com/872FDBm.gif > awesome
cat awesome

Better yet, the output can be compressed using a program like gzip

img2ansi -animate -width=80 -repeat=5 https://i.imgur.com/872FDBm.gif | gzip > awesome.gz
gzip -dc awesome.gz

The size difference can be substantial for large images (like GIFs).

$ ls -lh awsome*
-rw-rw-r-- 1 bmatsuo bmatsuo 1.4M Jun 20 01:52 awesome
-rw-rw-r-- 1 bmatsuo bmatsuo 114K Jun 20 01:52 awesome.gz

Manipulating images

For simple manipulation and combination of images and text unix-friendly tools like those provided by ImageMagick can be piped directly into img2ansi.

convert -background transparent -fill red -pointsize 72 label:"blorp" gif:- | img2ansi -scale

img2ansi's People

Contributors

bmatsuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.