NAME

Prima::Image::Magick - Juggle images between Prima and Image::Magick

SYNOPSIS

use Prima::Image::Magick;

my $i = Prima::Image-> new( ... );  # native prima images
$i-> MedianFilter( radius => 5);    # can call Image::Magick methods

DESCRIPTION

Allows transformations between Prima images and Image::Magick images. Exports all methods found on Image::Magick into Prima::Image space, thus opening the possibilities of ImageMagick for Prima images.

Prima::Image API

The mutator methods found on Image::Magick namespace are wrapped and imported into Prima::Image space, so that an image is implictly converted to Image::Magick and back, so that for example

$prima_image-> Edge( radius => 5);

is actually the same as

my $m = prima_to_magick( $prima_image);
$m-> Edge( radius => 5);
$prima_image = magick_to_prima( $m);

except that $prima_image internally remains the same perl object.

This approach is obviusly ineffective when more than one call to ImageMagick code is required. To avoid the ineffeciency, wrappers BeginMagick and EndMagick are declared, so

$prima_image-> BeginMagick;
$prima_image-> Edge( radius => 5);
$prima_image-> Enhance;
$prima_image-> EndMagick;

is same as

my $m = prima_to_magick( $prima_image);
$m-> Edge( radius => 5);
$m-> Enhance;
$prima_image = magick_to_prima( $m);

Prima::Image::Magick API

prima_to_magick $magick_image

Returns a deep copy of $magick_image stored in a new instance of Prima::Image object. $magick_image must contain exactly one ImageMagick bitmap. This means that empty objects and objects f.ex. after Read('file1', 'file2') cannot be used here. Use Image::Magick::Deconstruct to break image sequence into constituent parts.

Exported either by explicit request or as a part of use Prima::Image::Magick ':all' call.

prima_to_magick $prima_image

Returns a deep copy of $prima_image stored in a new instance of Image::Magick object.

Exported either by explicit request or as a part of use Prima::Image::Magick ':all' call.

convert_to_magick $prima_image, $magick_image

Copies content of $prima_image to $magick_image. Not to be called directy unless really necessary; the method is not exported, and its syntax may change in future.

convert_to_prima $magick_image, $prima_image

Copies content of $magick_image to $prima_image. Not to be called directy unless really necessary; the method is not exported, and its syntax may change in future.

SEE ALSO

Prima, Image::Magick, "example.pl" in examples.

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by Dmitry Karasik

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.