Image::ANSI - (DEPRECATED) Load, create, manipulate and save ANSI files
This module has been replaced by Image:TextMode.
use Image::ANSI; # Read in a file... my $img = Image::ANSI->new( file => 'file.ans' ); # Image width and height my $w = $img->width; my $h = $img->height; # get and put "pixels" my $pixel = $img->getpixel( $x, $y ); $img->putpixel( $x, $y, $pixel ); # create a thumbnail my $png = $img->as_png( mode => 'thumbnail' ); # export it as a png my $png = $img->as_png( mode => 'full' ); # use a custom font my $png = $img->as_png( mode => 'full', font => 'Image::ANSI::Font::8x8' ); # write the ANSI to a file $img->write( file => 'out.ans' );
This module allows you to load, create and manipulate files made up of ANSI escape codes, aka ANSI art.
To install this module via Module::Build:
perl Build.PL ./Build # or `perl Build` ./Build test # or `perl Build test` ./Build install # or `perl Build install`
To install this module via ExtUtils::MakeMaker:
perl Makefile.PL make make test make install
Creates a new ANSI image. Currently only reads in data.
# filename $ansi = Image::ANSI->new( file => 'file.ans' ); # file handle $ansi = Image::ANSI->new( handle => $handle ); # string $ansi = Image::ANSI->new( string => $string );
Clears any in-memory data.
Reads in an ANSI.
Writes the ANSI data to a file, filehandle or string.
Returns the ANSI output as a scalar.
Sets the pixel at $x, $y with $pixel (which should be an Image::ANSI::Pixel).
Returns the Image::ANSI::Pixel object at $x, $y (or undef).
Generic get / set method used by both getpixel and putpixel.
Returns the image width.
Returns the image height.
Gets / sets the SAUCE object associated with the ANSI.
find the largest x on line $y (default 0 ).
clears lines $y.
strip the attributes and return only the characters.
Returns a binary PNG version of the image.
# Thumbnail -- Default $ansi->as_png( mode => 'thumbnail' ); # Full size $ansi->as_png( mode => 'full' );
This function is just a wrapper around as_png_thumbnail() and as_png_full().
Creates a thumbnail version of the ANSI.
Creates a full-size replica of the ANSI. You can pass a "crop" option to crop the image at certain height.
# Crop it after 25 (text-mode) rows $ansi->as_png_full( crop => 25 );
Copyright 2004-2009 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.