Image::Term256Color - Display images in your 256 color terminal! (kinda)


Version 0.04


Converts an image to 256 color terminal displayable ascii. Mostly for fun.

    use Image::Term256Color;

    print Image::Term256Color::convert( 'myimage.jpg' ) . "\n";

Scalar context spits out a string containing term color coded text representing the entire image.

    print Image::Term256Color::convert( 'myimage.jpg' , { scale_ratio => .5 } ) . "\n";

Scale 'myimage.jpg' by 50% before converting.

    my @img_rows = Image::Term256Color::convert( 'myimage.jpg' );

Array context gives an array of strings. Each string representing a row within the image. Unlike scalar context, there are no newlines.



Image::Term256Color::convert( $filename , \%options );

Image::Term256Color::convert( *FILEHANDLE , \%options );

Image::Term256Color::convert( $data , \%options );

Accepts a $filename , *FILEHANDLE or scalar containing image data for PNG , Jpeg , Gif and GD2 image types. This is thrown right into GD::Image (See GD);

The \%options hashref may consist of:

  • scale_ratio

    scale_ratio is a decimal number used to scale the original image before converting to colored text.

  • scale_x

    scale_x represents the number of characters wide the resulting encoded image will be. This option scales the image height proportionally.

  • utf8

    utf8 can either be 0 or 1. This option enables utf8 'block' characters that effectively double the resolution.

Returns a color coded string with newlines in scalar context and an array of strings represting rows in the image in array context.

Returns a 0 in scalar context and empty array in array context if there is an error with the provided image.


Please look at img2term and nyan bundled with this distribution.


Colin, <moshen at>


Please report any bugs or feature requests through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Image::Term256Color

You can also look for information at:


GD! It does all the work.


Copyright 2011 Colin.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.