Image::ANSI - (DEPRECATED) Load, create, manipulate and save ANSI files


Image-ANSI documentation  | view source Contained in the Image-ANSI distribution.

Index


NAME

Top

Image::ANSI - (DEPRECATED) Load, create, manipulate and save ANSI files

DEPRECATION NOTICE

Top

    This module has been replaced by Image:TextMode.

SYNOPSIS

Top

	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' );

DESCRIPTION

Top

This module allows you to load, create and manipulate files made up of ANSI escape codes, aka ANSI art.

INSTALLATION

Top

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

METHODS

Top

new( %options )

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 );

clear( )

Clears any in-memory data.

read( %options )

Reads in an ANSI.

write( %options )

Writes the ANSI data to a file, filehandle or string.

as_string( %options )

Returns the ANSI output as a scalar.

putpixel( $x, $y, $pixel )

Sets the pixel at $x, $y with $pixel (which should be an Image::ANSI::Pixel).

getpixel( $x, $y )

Returns the Image::ANSI::Pixel object at $x, $y (or undef).

pixel( [$x, $y, $pixel] )

Generic get / set method used by both getpixel and putpixel.

width( )

Returns the image width.

height( )

Returns the image height.

sauce( [File::SAUCE] )

Gets / sets the SAUCE object associated with the ANSI.

max_x( [$y] )

find the largest x on line $y (default 0 ).

clear_line( $y )

clears lines $y.

as_ascii( )

strip the attributes and return only the characters.

as_png( [%options] )

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().

as_png_thumbnail( [%options] )

Creates a thumbnail version of the ANSI.

as_png_full( [%options] )

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 );

AUTHOR

Top

* Brian Cassidy <bricas@cpan.org>

COPYRIGHT AND LICENSE

Top


Image-ANSI documentation  | view source Contained in the Image-ANSI distribution.