NAME
ansipic - show images in the terminal as lines of text
SYNOPSIS
ansipic [options] file ...
-m#, --method=# method: kitty, or auto (default)
-w#, --width=# columns that an image may take (number or RPN)
-H#, --height=# rows that an image may take (number or RPN)
-t#, --types=# types of images shown: png,jpeg,gif (default)
--term=CxR:WxH size of the terminal and of a cell in pixels
--tty=# where the images are sent (default: /dev/tty)
-h, --help show help
-v, --version show version
VERSION
Version 0.05
EXAMPLES
ansipic logo.png
ansipic -w 2/ *.png | LESSUTFCHARDEF=10EEEE:p less -RX
ansipic images/*.png | ansicolumn -c 2
DESCRIPTION

ansipic shows image files in the terminal, by Text::ANSI::Image. Each image is printed as lines of text: the cells of the image, which the terminal draws. The lines can be paged by less and put in columns by ansicolumn(1), as any other text.
PNG, JPEG and GIF files are shown. The image itself is sent to the terminal (/dev/tty), so the lines may go to a pipe, and are shown when they come to the terminal.
A file which is not shown is told on the standard error, and the status is 1.
TERMINALS
The images are drawn by the Unicode placeholders of the kitty graphics protocol, which these terminals support:
kitty
Ghostty (cmux too, which is built on it)
iTerm2 3.7.3 or later
The terminal is told by the environment: TERM_PROGRAM is ghostty, or iTerm.app with TERM_PROGRAM_VERSION 3.7.3 or later, or TERM is xterm-kitty. In another terminal, ansipic shows nothing, and ends with the status 2.
The environment may be wrong. A terminal started from another one, as by open -a from iTerm2, may inherit its TERM_PROGRAM; in tmux or screen, the terminal outside is not told. When the terminal does support the protocol, -m kitty shows the images anyway.
To page the lines by less, less has to take the placeholder character U+10EEEE as a printable one: less 632 or later does with LESSUTFCHARDEF=10EEEE:p. -R passes the colors, which are the ids of the images, and -X keeps less on the screen where the images are: Ghostty keeps an image on the screen it is sent to, and does not show it on the alternate screen.
ansipic *.png | LESSUTFCHARDEF=10EEEE:p less -RX
A search of less which matches the lines, as with .*, draws the cells in the color of its highlight instead of the image; ESC-u shows the image again.
The image is sent to the terminal, not to the output. The output saved in a file shows no image when it is shown later, unless the terminal still has the image.
OPTIONS
- -m name, --method=name
-
The method by which images are drawn:
kitty, the Unicode placeholders of the kitty graphics protocol (kitty, Ghostty and iTerm2 3.7.3 or later), orauto(the default), the first which the terminal supports. - -w n, --width=n
- -H n, --height=n
-
The most columns and rows that an image may take (default: the terminal width, and its height but four lines). An image is as large as its pixels, and not larger than that room.
The value is a number, or an RPN (Reverse Polish Notation) expression with the terminal width (for --width) or height (for --height) as the initial value: -w 2/ is half the width of the terminal, and -w 10- the width but ten columns. A
=before the value is taken away, as ansifold(1) takes the expression: -w=2/ is the same as -w 2/. - -t list, --types=list
-
The types of images shown, separated by commas:
png,jpegandgif(default: all). - --term=COLSxROWS[:WxH]
-
The size of the terminal, and of a cell in pixels. By default it is read from /dev/tty. The size of a cell not given here is TERM_CELLSIZE; see "ENVIRONMENT".
- --tty=file
-
Where the images are sent (default: /dev/tty).
- -h, --help
- -v, --version
ENVIRONMENT
- TERM_CELLSIZE=WxH
-
The size of a cell, in the pixels of an image. Without it, the size is asked of the terminal (iTerm2), so that an image takes the same cells on a Retina display and on others. It saves asking:
eval "$(perl -MText::ANSI::Image=shellenv -e shellenv)"
SEE ALSO
Text::ANSI::Image, App::ansicolumn
AUTHOR
Kazumasa Utashiro
LICENSE
Copyright © 2026 Kazumasa Utashiro.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.