++ed by:
DOLMEN MOSHEN KEEDI

3 PAUSE users

Colin Kennedy

NAME

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

VERSION

Version 0.04

SYNOPSIS

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.

SUBROUTINES/METHODS

convert

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.

EXAMPLES

Please look at img2term and nyan bundled with this distribution.

AUTHOR

Colin, <moshen at cpan.org>

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/moshen/Image-Term256Color/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

    perldoc Image::Term256Color

You can also look for information at:

ACKNOWLEDGEMENTS

GD! It does all the work.

LICENSE AND COPYRIGHT

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 http://dev.perl.org/licenses/ for more information.