Generate ANSI-/Ascii-art version images/Gifs in your terminal.

Overview

ANSI-Art

logo

NOTE: This toy project is not yet finished.

ANSI-version Logo

ansi-logo

Block ANSI-version Logo

block-ansi-logo

ASCII-version Logo

ascii-logo

Support Platform

You are kindly reminded to refer to this Github Gist to check whether your terminal meets the requirements to run ANSI-art. For the colored version, we rely on the "true color" of the terminal to preserve the initial RGB values. There are many terminal apps that supports true color, I recommend you to use iTerm2. However, it is sad to know that MacOS' terminal builtin (Terminal.app) does not support it. Don't run ANSI-art on it unless you are expecting a mess on your screen.

For the ASCII art version, this true color feature is not required.

Usage

To build the project and get the executable:

$ cd ANSI-art
$ go build -o ansi-art main.go

Then, with command ./ansi-art --help you will get the following help info:

ANSI-Art converts your image & Gif to ANSI characters (with color) that can show in the console.
Users can speicify the characters to use, size of the image, etc to get the best results. some sample commands are:

./ansi-art image pic/messi.png -W 150 -H 60 -a -C 40
./ansi-art gif pic/sharingan.gif -W 150 -H 60 -s SASUKE -d 300 -m bgm/uefa.mp3

Usage:
  ansi-art [command]

Available Commands:
  completion  generate the autocompletion script for the specified shell
  gif         Playing gif in your terminal.
  help        Help about any command
  image       Show your image in the terminal.

Flags:
  -h, --help   help for ansi-art

Now we look into subcommands.

Image

With Command ./ansi-art image --help, the following are displayed:

Show your image in the terminal.

Usage:
  ansi-art image [flags]

Flags:
  -a, --ascii             ansi or ascii art
  -b, --blockMode         character or block mode
  -C, --contrast float    increase/decrease the imgContrast (-100 ~ 100)
  -f, --filename string   the input gif file (default "demo.gif")
  -H, --height int        the resized height of the image (default 100)
  -h, --help              help for image
  -s, --seq string        the string of ANSI chars that build the image (default "01")
  -S, --sigma float       sharpening factor
  -W, --width int         the resized width of the image (default 100)

So a valid command can be:

./ansi-art image -f pic/messi.png -W 150 -H 60 -C 20 -S 10 -a

The output of this command is as follows: messi_output or

/ansi-art image -f pic/messi.png -W 150 -H 60 -C 20 -S 10 -s MESSI

This time the result is: messi_ansi Or you can add a -b command to the nearest above command to get the pixel version: messi_block NOTE that these are all displayed IN YOUR TERMINAL! (We will provide an export to image function later for sure though.) One last thing to remind is that --seq is only effective when no -a or -b is specified; when -a and -b show together, -a is of higher priority.

Gif

These are the output of command ./ansi-art gif --help:

Playing gif in your terminal.

Usage:
  ansi-art gif [flags]

Flags:
  -a, --ascii             ansi or ascii art
  -b, --blockMode         character or block mode
  -C, --contrast float    increase/decrease the imgContrast (-100 ~ 100)
  -d, --duration int      the duration(ms) of each frame, used to control speed (default 200)
  -f, --filename string   the input gif file (default "pic/demo.gif")
  -H, --height int        the resized height of the image (default 100)
  -h, --help              help for gif
  -L, --loop int          The loop number of the gif (default 1)
  -m, --music string      the background music file (default "bgm/smb.mp3")
  -s, --seq string        the string of ANSI chars that build the image (default "01")
  -S, --sigma float       sharpening factor
  -W, --width int         the resized width of the image (default 100)

Most flags are the same as in the image subcommand, with --duration, --loop, --duration, and --music as the new addons. The meaning of each flag is illustrated clearly above.

With command ./ansi-art gif -f pic/sharingan.gif -W 250 -H 60 -d 100 -a -m bgm/NadaNaruto.mp3 -C 30 -S 30 --loop 10, we can get:

sasuke.mp4

Likewise, command ./ansi-art gif -f pic/brother_fight.gif -W 150 -H 35 -d 200 -C 10 --seq BROTHER --loop 4 -m bgm/fight.mp3 can yield:

2021-07-28.10.04.56.mov

Codebase

  • art converts an image to ASCII-art or ANSI-art. For ANSI-art, there are text-based and block-based versions.
  • rank is used to rank the intensities of ascii symbols so that they can represent different grayscale values. Generally it is font-specific. My console uses monaco font, so I take it as an example. You are encouraged to try other fonts by downloading the ttf file to directory font, and change the line 56 to your font file. Currently it is hardcoded, but can be set as cli arguments. Forgive me for not doing so because of lazyness.
  • decode extracts frames from gif/videos. Currently only gif is supported.
  • cmd is used to set command arguments with the powerful package Cobra.
  • We also support background music playing with beep.

TODO

  1. Support mp4 decoding.
  2. Export the output to file: image/gif/mp4.
  3. Web version.

Reference

Owner
Weiran Huang
A Pythonista, now also a Gopher, starting to be a Rustacean.
Weiran Huang
Draw images in your ANSI terminal with true color

___ _____ ____ / _ \/ _/ |/_/ /____ ______ _ Made with love by Eliuk Blau / ___// /_> </ __/ -_) __/ ' \ https://github.com/eliukblau/pix

Eliuk Blau 878 May 19, 2022
Browser based Ascii-art generator with simple web design

Browser based Ascii-art generator with simple web design

null 0 Nov 12, 2021
Advanced ANSI style & color support for your terminal applications

termenv lets you safely use advanced styling options on the terminal. It gathers information about the terminal environment in terms of its ANSI & col

Christian Muehlhaeuser 1.1k May 17, 2022
Small, fast library to create ANSI colored strings and codes. [go, golang]

ansi Package ansi is a small, fast library to create ANSI colored strings and codes. Install Get it go get -u github.com/mgutz/ansi Example import "gi

Mario Gutierrez 362 Apr 23, 2022
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

asciigraph Go package to make lightweight ASCII line graphs ╭┈╯. Installation go get github.com/guptarohit/asciigraph Usage Basic graph package main

Rohit Gupta 1.9k May 12, 2022
ASCII table in golang

ASCII Table Writer Generate ASCII table on the fly ... Installation is simple as go get github.com/olekukonko/tablewriter Features Automatic Padding

Oleku Konko 3.4k May 22, 2022
OTF font with vertical bars for one-line ASCII spectrum analyzers, graphs, etc

graph-bars-font OTF font with vertical bars for one-line ASCII spectrum analyzers, graphs, etc. I didn't find anything similar on the net so I decided

Andrew Dunai 16 Apr 16, 2022
Go-Suit is a very very wacky version of a bash terminal but in go, however with a little twitst

Go-Suit Go-Suit is a very very wacky version of a bash terminal but in go, however with a little twitst languages -> Go-Lang packages Third Party -> g

RE43P3R 1 Apr 2, 2022
a simple golang program that shows the time in asci art.

Curtime a simple golang program that shows the time in asci art. Installing Other For other distros you can grab a executable file from the releases.

null 1 Oct 8, 2021
Little golang app that allows you to download a youtube video as mp3, and optionally embed ID3 tags -Cover Art, Artist ...-

yt2mp3 Little golang app that allows you to download a youtube video as mp3, and optionally embed ID3 tags -Cover Art, Artist ...- Instructions At the

null 0 Dec 25, 2021
Pi-fetch - get a summary of your pi-hole stats from your terminal

pi-fetch get a summary of your pi-hole stats from your terminal _ ___ _ _ ___|_|___| _|___| |_ ___| |_ | . | |___| _| -_| _

wise 0 Jan 9, 2022
Command line tool to copy images from a camera SD card to your hard drive

Command line tool to copy images from a camera SD card to your hard drive

Clay Dowling 0 Nov 26, 2021
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.

Stonks is a terminal based stock visualizer and tracker. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Eric Moynihan 510 May 13, 2022
A dead simple CLI tool that prints the next semantic version based on the last tag of your git repository

nextver A dead simple CLI tool that prints the next semantic version based on the last tag of your git repository. Install go install github.com/junk1

Tom 3 Jan 27, 2022
A CLI Tool to easily generate your Terraform configuration

Tf Tf is a command line tool to easily generate your Terraform configuration with an interactive prompt. Inspiration Boredom in Covid-19 Installation

Gowtham Munukutla 20 May 10, 2021
A tool to manage all your boilerplate from cli and generate files for you !

A tool to manage all your boilerplate from cli and generate files for you !

null 26 Apr 11, 2022
Show Languages In Code. A fast and lightweight CLI to generate stats on the languages inside your project

slic Show Languages In Code. Usage Run it with an -h flag to list all commands. -d flag can be used to specify the directory of search -i flag can be

Saurav Pal 3 Dec 25, 2021
Are you programming and suddenly your stomach is rumbling? No problem, order your Ifood without leaving your favorite text editor ❤️

vim-ifood Você ta programando e de repente bateu aquela fome? Sem problemas, peça seu Ifood sem sair do seu editor de texto favorito ❤️ Are you progra

Felipe Volpone 4 Nov 12, 2021
gomerge is a tool to quickly bulk merge several pull requests from your terminal.

Gomerge is a tool to quickly enable you to bulk merge Github pull requests from your terminal. The intention of this tool is to simplfy, and eventually automate the merging of github pull requests. This tool should be able to run on most systems.

Cian Gallagher 31 Mar 24, 2022