jp2a
Convert JPEG 2000 images to other formats
TLDR
Read JPEG image from a file and print in ASCII
Read JPEG image from a URL and print in ASCII
Colorize the ASCII output
Specify characters to be used for the ASCII output
Write the ASCII output into a file
Write the ASCII output in HTML file format, suitable for viewing in web browsers
SYNOPSIS
jp2a [options] <image_file(s)>
PARAMETERS
--width=N
Sets the output width in characters. Default is 80.
--height=N
Sets the output height in characters.
--ratio
Preserves the image's aspect ratio (this is the default behavior).
--stretch
Stretches the image to fit the specified width and height, ignoring aspect ratio.
--chars=STRING
Specifies the custom character set to use for ASCII art, ordered from darkest to lightest intensity.
--invert
Inverts the black/white (or dark/light) mapping, useful for light terminal backgrounds.
--color
Enables color output using ANSI escape codes. By default, output is monochrome.
--html
Outputs HTML code instead of plain text, suitable for web display.
--output=FILENAME
Redirects the output to a specified file instead of standard output.
--grayscale
Converts the image to grayscale before processing, affecting color and intensity mapping.
--ansi
Ensures output uses ANSI escape codes for terminal color and formatting.
--term-width
Automatically sets the output width to the current terminal width.
DESCRIPTION
jp2a is a command-line utility designed to convert graphical images into ASCII art, suitable for display in a text-based terminal. It supports popular image formats like JPEG, PNG, BMP, and GIF.
Users can control various aspects of the output, such as dimensions, character set, color rendering, and output destination. It processes image pixels and maps them to ASCII characters based on intensity or color, creating a textual representation of the original image. This makes it a versatile tool for creative display or simple image preview in environments without graphical capabilities.
CAVEATS
The quality of the ASCII art heavily depends on the source image's characteristics and the chosen character set. Very complex or high-resolution images may not translate well, appearing abstract or unrecognizably detailed. Performance can vary with image size and system resources. Color output is dependent on terminal emulator capabilities.
HTML OUTPUT CAPABILITIES
Beyond terminal display, jp2a can generate HTML output (using the --html option), making it possible to embed ASCII art images directly into web pages. This feature includes options for setting HTML width, character usage instead of pixels, and adding borders.
CUSTOM CHARACTER SETS
A powerful feature of jp2a is the ability to define a custom character set using the --chars option. This allows users to fine-tune the granularity and visual style of the ASCII art, mapping specific characters to different pixel intensity levels, from dark (first character) to light (last character).
HISTORY
jp2a emerged as a practical tool for ASCII art conversion in the command-line environment. While its exact initial release date is not widely publicized, it has been a staple in Linux distributions for a considerable period, often included in standard repositories. Its development has focused on providing a lightweight and efficient way to transform images into textual representations, catering to both artistic expression and simple visual previewing in terminal-centric workflows.