The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::MathImage::Image::Base::Magick -- draw images using Image Magick

SYNOPSIS

 use App::MathImage::Image::Base::Magick;
 my $image = App::MathImage::Image::Base::Magick->new (-width => 100,
                                                       -height => 100);
 $image->rectangle (0,0, 99,99, 'white');
 $image->xy (20,20, 'black');
 $image->line (50,50, 70,70, '#FF00FF');
 $image->line (50,50, 70,70, '#0000AAAA9999');
 $image->save ('/some/filename.png');

CLASS HIERARCHY

App::MathImage::Image::Base::Magick is a subclass of Image::Base,

    Image::Base
      App::MathImage::Image::Base::Magick

DESCRIPTION

App::MathImage::Image::Base::Magick extends Image::Base to create or update image files using Image::Magick.

Colour names are anything recognised by ImageMagick,

    file:///usr/share/doc/imagemagick/www/color.html

It includes 1, 2 and 4-digit hex "#RGB", "#RRGGBB", "#RRRRGGGGBBBB", and other colour model forms, and a table of names roughly per X11 plus a config/colors.xml for extras.

By default ImageMagick uses "anti-aliasing" to blur the edges of lines etc drawn. This is unlike the other Image::Base modules but currently it's not changed or overridden in the methods here. Perhaps that will change.

FUNCTIONS

$image = App::MathImage::Image::Base::Magick->new (key=>value,...)

Create and return a new image object. A new image can be started with -width and -height,

    $image = App::MathImage::Image::Base::Magick->new (-width => 200, -height => 100);

Or an existing file can be read,

    $image = App::MathImage::Image::Base::Magick->new (-file => '/some/filename.png');

Or an Image::Magick object can be given,

    $image = App::MathImage::Image::Base::Magick->new (-imagemagick => $mobj);

ATTRIBUTES

-width (integer)
-height (integer)

Setting these changes the size of the image.

-imagemagick

The underlying Image::Magick object.

-file (string, default undef)

The filename for load or save, or passed to new to load a file.

ImageMagick normally expands a "%d" in filenames to a sequence number, but that's avoided here, instead the filename is use literally, the same as other Image::Base classes do.

-zlib_compression (integer 0-9 or -1, default undef)

The amount of data compression to apply when saving. The value is Zlib style 0 for no compression up to 9 for maximum effort. -1 means Zlib's default, usually 6. undef or never set means ImageMagick's default, which is 7. (This attribute becomes the ImageMagick "quality" parameter.)

SEE ALSO

Image::Base, Image::Base::GD, Image::Base::PNGwriter, Image::Magick, Image::Xbm, Image::Xpm, Image::Pbm