img2sixel
Convert images to sixel graphics
TLDR
Display an image in the terminal
Resize the image to the specified width and height before displaying it
SYNOPSIS
img2sixel [options]
PARAMETERS
-h, --help
Show help message and exit.
-v, --version
Show version information and exit.
-n
Number of colors to reduce the image to (default: 256).
-q
Quality of color reduction (0-100, default: 75).
-d
Error diffusion (0-100, default: 50).
-g, --grayscale
Convert image to grayscale.
-w
Set output width in pixels.
-H
Set output height in pixels.
-p
Select color palette (default: auto, available palettes depends on build options).
-e, --escape
Escape SIXEL sequences.
-i, --invert
Invert image colors.
DESCRIPTION
The img2sixel command converts image files into the SIXEL graphics format, suitable for display on terminals and printers that support SIXEL. SIXEL is a bitmap graphics format that allows displaying raster images on devices like DEC VT-series terminals. img2sixel supports various image formats, including PNG, JPEG, GIF, and others, relying on external libraries like ImageMagick for image decoding. It aims to provide a simple way to render images on devices where full graphical capabilities aren't available, offering a lightweight alternative for image display within text-based environments. The command can be used interactively or within scripts to dynamically generate SIXEL output from image files.
The generated output can then be redirected to a SIXEL-capable terminal or printer for visualization.
Using img2sixel enables displaying color images in environments where limited graphical options are the standard.
This is especially useful for remote terminal sessions, embedded systems, or older hardware.
CAVEATS
Requires external libraries like ImageMagick or GraphicsMagick to support various image formats. The quality of the SIXEL output depends on the image and the chosen color reduction parameters. Some terminals have limited SIXEL support or may not display colors accurately.
EXAMPLES
Convert a PNG image to SIXEL with default settings:
img2sixel image.png
Convert a JPEG image to SIXEL and limit the color palette to 16 colors:
img2sixel -n 16 image.jpg
Convert a GIF image to SIXEL and set the output width to 400 pixels:
img2sixel -w 400 image.gif
COLOR REPRESENTATION
The number of colors (-n option) is crucial for determining the visual fidelity of the resulting SIXEL image. Reducing colors can introduce artifacts or posterization. Experimenting with different values often produces the best results for a given input image and terminal.
HISTORY
SIXEL graphics format has been around since the days of DEC VT terminals. The img2sixel command provides a modern implementation for converting images into this format, allowing usage on modern systems with SIXEL-capable terminals. Development focused on providing a versatile tool that works with different image formats.