image_to_ascii
is a simple command-line C implementation of an image-to-ASCII converter.
Given an instruction and the file name, it will recreate a terminal-compatible representation of the given image.
The program uses ANSI escape sequences to print colored output, that is however limited only to the original 8 available colors.
Although the black-and-white functionality seems good, the colored outputs may seem a bit poor due to the really restricted supplied color palette.
At the top of the source file there are two macros (TERM_WIDTH
and TERM_HEIGHT
) that can be modified as needed in order to change the output size.
For more informations use image_to_ascii -h
.
As an example, here is an image (generated by a program inspired by scipython.com):
And the following is its ASCII form (80x24):
The program should work in every unix system that supports ANSI escape sequences (see for example here).
In order to compile the given code, two nice single-header file libraries are needed:
After this, compilation is pretty straightforward. For example, using the GNU Compiler:
gcc image_to_ascii.c -lm -o image_to_ascii