Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/bmatsuo/img2ansi

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/bmatsuo/img2ansi

  • v0.0.0-20231121233033-dc3794b6e02a
  • Source
  • Go
  • Socket score

Version published
Created
Source

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

FAQs

Package last updated on 21 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc