GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Image::Caa(3) User Contributed Perl Documentation Image::Caa(3)

Image::Caa - Colored ASCII Art

  use Image::Caa;
  use Image::Magick;


  # load an image

  my $image = Image::Magick->new;
  $image->Read('sunset.jpg');


  # display it as ASCII Art

  my $caa = new Image::Caa();
  $caa->draw_bitmap(0, 0, 40, 20, $image);


  # some fancy options

  my $caa = new Image::Caa(
    driver => 'DriverANSI',
    dither => 'DitherOrdered8',
    black_bg => 1,
  );
  $caa->draw_bitmap(0, 0, 40, 20, $image);

This module outputs "Image::Magick" image objects as ASCII Art, using a variety of output dithering modes and output drivers (currently supported is a plain old ANSI termical output driver and a curses driver).

"new( opt => 'value', ... )"
Returns a new "Image::Caa" object. The options are as follows:
"driver"

Output driver. Valid values are:

  • "DriverANSI" (default)
  • "DriverCurses"
"dither"

Dithering mode. Valid values are:

  • "DitherNone" (default)
  • "DitherOrdered2"
  • "DitherOrdered4"
  • "DitherOrdered8"
  • "DitherRandom"
  • "black_bg"

    Set to 1 to enable black background mode. By default, we use colored backgrounds to allow 256 colors (16 foreground x 16 background)

  • "window"

    Used only by the Curses output driver. Indicates the Curses window to write output into.

"draw_bitmap($x1, $y1, $x2, $y2, $image)"
Draws the image $image within the box bounded by "($x1,$y1)-($x2,$y2)". Note that the default (ANSI) output driver ignores the origin position as uses only the absolute box size.

Both the dithering and driver backends are plugable and fairly easy to create - just create modules in the Image::Caa::* namespace. Dither modules need to implement the "new()", "init($line)", "get()" and "increment()" methods. Driver modules need to implement the "new()", "init()", "set_color($fg, $bg)", "putchar($x, $y, $char)" and "fini()" methods. Look at the existing modules for guidance.

Copyright (C) 2006, Cal Henderson <cal@iamcal.com>

This library is based on libcaca's bitmap.c

libcaca is Copyright (C) 2004 Sam Hocevar <sam@zoy.org>

libcaca is licensed under the GNU Lesser General Publice License

Image::Magick, <http://sam.zoy.org/libcaca/>
2006-08-22 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.