LinuxCommandLibrary

pixterm

Display images in the terminal

TLDR

Render a static image directly in the terminal

$ pixterm [path/to/file]
copy

Use the image's original aspect ratio
$ pixterm -s 2 [path/to/file]
copy

Specify a custom aspect ratio using a specific number of [t]erminal [r]ows and [c]olumns
$ pixterm -tr [24] -tc [80] [path/to/file]
copy

Filter the output with a [m]atte background color and character [d]ithering
$ pixterm -m [000000] -d 2 [path/to/file]
copy

SYNOPSIS

pixterm [options]

PARAMETERS

--width
    Set the width of the output image.

--height
    Set the height of the output image.

--scale
    Scale the image by a factor.

--dither
    Use dithering algorithm (e.g., Floyd-Steinberg).

--truecolor
    Enable true color (24-bit) support.

--braille
    Use braille characters for rendering (higher density).

--help
    Show the help message and exit.


    The path to the image file to display.

DESCRIPTION

pixterm is a command-line tool designed to display images directly within your terminal emulator. It works by converting image pixels into terminal characters, using color codes and character density to approximate the original image. This allows you to view images without relying on a graphical user interface (GUI) or external image viewers. pixterm offers various options for controlling the output, such as scaling, aspect ratio preservation, and dithering, enabling users to customize the image rendering to best suit their terminal's capabilities and personal preferences. It's useful for quick previews, debugging, or simply displaying images on systems where a GUI is unavailable or impractical.

pixterm is often used in scripting and automation workflows, where image processing or display needs to be performed programmatically. The output quality can vary depending on the terminal's font, color support, and the chosen rendering options. It generally trades off image fidelity for the convenience of terminal-based viewing.

CAVEATS

Output quality depends heavily on the terminal's color support, font, and size. Some terminals may not render images accurately or at all. The braille option might produce better results, but the terminal MUST support unicode.

EXAMPLES

To display an image named 'image.png' in the terminal:
pixterm image.png

To display 'image.png' with a width of 80 characters:
pixterm --width 80 image.png

To display 'image.png' using Floyd-Steinberg dithering:
pixterm --dither Floyd-Steinberg image.png

To use braille mode:
pixterm --braille image.png

SEE ALSO

img2txt(1), asciiart(1)

Copied to clipboard