Actions Status MetaCPAN Release

NAME

Text::ANSI::Image - images as lines of text for the terminal

SYNOPSIS

use Text::ANSI::Image;

my $img = Text::ANSI::Image->new or exit;   # no method for the terminal
print "$_\n" for $img->rows('logo.png', width => 40);
$img->flush;

VERSION

Version 0.01

DESCRIPTION

This module draws an image in a terminal as lines of text. The lines can be laid out, folded around, paged and scrolled like any other text: put in columns by ansicolumn(1), shown by less, and they stay with the text around them.

How the lines are made is the method. Each method is a module Text::ANSI::Image::NAME. The one of this distribution is:

PNG, JPEG and GIF files are shown. The type is detected from the content, not the name of the file. The kitty method sends PNG; a JPEG or a GIF is converted to PNG by sips (macOS) or ImageMagick, and is not shown without them. A PNG much larger than the room is reduced by the same tools to send less data, or sent as it is without them.

METHODS

METHOD MODULES

A method is a module Text::ANSI::Image::NAME, a subclass of Text::ANSI::Image, which has:

png is there for a method which needs a PNG of the image.

SEE ALSO

Terminal graphics protocol, Unicode placeholders

App::mdee, which shows the images of Markdown files with it.

App::ansicolumn, Text::ANSI::Fold

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.