asciiart
Convert images to ASCII art
TLDR
Read an image from a file and print in ASCII
Read an image from a URL and print in ASCII
Choose the output width (default is 100)
Colorize the ASCII output
Choose the output format (default format is text)
Invert the character map
SYNOPSIS
asciiart [OPTIONS] input_file
PARAMETERS
-o
Specify an output file instead of standard output.
-W
Set the output width in characters.
-H
Set the output height in lines.
--chars
Define the character set to use for rendering. Characters should be ordered from lightest to darkest.
--color, -c
Enable color output using terminal escape codes.
--grayscale, -g
Force grayscale output, ignoring color information.
--html
Output HTML-formatted ASCII art, often enclosed in <pre> tags.
--ansi
Output ANSI escape code formatted ASCII art suitable for many terminals.
--invert
Invert character mapping (light pixels become dark characters, and vice-versa).
--dither
Enable dithering to improve detail representation, especially for low-color or grayscale output.
--help
Display help message and exit.
--version
Display version information and exit.
DESCRIPTION
The asciiart command, often a script or wrapper around utilities like jp2a or img2txt (from libcaca), is designed to transform graphical images (e.g., JPEG, PNG, GIF) into textual representations composed of ASCII characters.
It achieves this by mapping pixel intensity or color to different ASCII characters, creating a low-resolution text-based rendition of the original image. The command typically offers options to control the output's width, character set used, color rendering, and output format. It's a popular tool for displaying images in terminal environments, creating unique text-based graphics, or simply for artistic purposes. While not universally pre-installed on all Linux distributions, its functionality is widely available through various packages.
CAVEATS
The asciiart command is not a standard, universally installed utility on all Linux distributions. Its presence and exact functionality can vary significantly. Often, it's a symbolic link or wrapper script for other image-to-ASCII converters like jp2a or img2txt.
Output quality heavily depends on the input image's resolution, the chosen output width, and the character set used. Very complex images may not translate well into recognizable ASCII art.
USAGE EXAMPLES
Here are some common ways to use the asciiart command:
Convert an image and print to standard output:
asciiart image.jpg
Convert with specific width and color, saving to a file:
asciiart -W 80 --color input.png > output.txt
Convert using a custom character set:
asciiart --chars ' .:-=+*#%@' photo.jpeg
CHARACTER SET IMPORTANCE
The effectiveness and visual fidelity of ASCII art largely depend on the selected character set. Characters are typically ordered from 'light' (less dense) to 'dark' (more dense). Denser characters (e.g., @, #, &, %, *) are used for darker areas of the image, while sparser characters (e.g., ., :, -, space) represent lighter areas. A well-chosen character set can significantly enhance the recognizable detail in the output.
HISTORY
The concept of ASCII art, representing images with text characters, predates digital computers. With the advent of text-based terminals, automated conversion tools emerged. The specific command named asciiart often acts as a user-friendly frontend or a simpler script for more robust image-to-text converters like jp2a (JPEG to ASCII) or utilities from the libcaca library, which have undergone continuous development since the late 20th century to improve rendering quality and feature sets. Thus, its 'history' is often intertwined with the development of these underlying tools and the broader ASCII art community.