_ _                 
                (_|_)                
   __ _ ___  ___ _ _ _ __ ___   __ _ 
  / _` / __|/ __| | | '_ ` _ \ / _` |
 | (_| \__ \ (__| | | | | | | | (_| |
  \__,_|___/\___|_|_|_| |_| |_|\__, |
                                __/ |
                               |___/ 

/as-keem-ɪdʒ/ or "askimage"

Command line tool to display images as ascii art on the terminal

Example

Usage

$ ./asciimg [-c] [-i] [-a] [-s] [-r resolution] [-t threshold] [-s vertical stretching] [image]...

Tested in:

Examples

$ asciimg -c image.png # print image.png in color
$ asciimg -c *.png # print all png files in color
$ echo demos/* | asciimg # print all files in the demos folder in black and white

Options

Option Default Description
-s false Render image using only the space character, depending on -c and -i this will produce different results. Worth testing.
-i false Set the color in the background instead of the foreground, good for images that have a white background or bright colors.
-a false Enable averaging for the image sampling algorithm. Averaging should produce closer representations of the input image, but will slow down the process.
-c false Use colored output, enable colors simply by adding the flag.
-t 30 Color sampling threshold, a higher threshold will generate less transitions between colors in the images, good for images with gradients.
-r width The resolution is the number of columns used when printing the image. It will default to the current size of the terminal.
-s 0.5 Vertical stretching factor for the image, or aspect ratio. It defaults to 0.5, numbers over 0.5 will stretch the image vertically, under 0.5 they will compress it.
-m - Display the man page for asciimg

Installation

  1. Download/Clone repository
  2. asciimg is built with Perl at the moment, so you'll need to install it if your OS doesn't have it already.
  3. Dependencies:

GD Library

# Mac OSX
$ brew install gd
# Linux (Ubuntu and similar)
$ sudo apt-get install libgd-gd2-perl
# Linux (Fedora, Red Hat...)
$ sudo yum -y install perl-GD

Windows: http://gnuwin32.sourceforge.net/packages/gd.htm

Configure cpan if necessary:

$ sudo perl -MCPAN -e shell

Perl modules:

Mac OSX

Patch GD from here: http://wangqinhu.com/install-gd-on-mavericks/ (this fixed all GD issues for me)

Then install the other dependencies the same way as Linux.

Linux

$ sudo cpan
cpan> install GD::Image
cpan> install Term::ANSIColor
cpan> install Term::ReadKey
cpan> install Pod::Usage
cpan> install Getopt::Long

Roadmap

Meta

Developed by Alejandro U. Alvarez - © 2015 - Licensed under the MIT License