Imager::Engines 0.54 review

Download
by rbytes.net on

Imager::Engines is a Perl module for programmable transformation operations. SYNOPSIS use Imager; my %opts; my @imgs;

License: Perl Artistic License
File size: 836K
Developer: Arnar M. Hrafnkelsson and Anthony Cook
0 stars award from rbytes.net

Imager::Engines is a Perl module for programmable transformation operations.

SYNOPSIS

use Imager;

my %opts;
my @imgs;
my $img;
...

my $newimg = $img->transform(
xexpr=>'x',
yexpr=>'y+10*sin((x+y)/10)')
or die $img->errstr;

my $newimg = Imager::transform2(%opts, @imgs)
or die "transform2 failed: $Imager::ERRSTR";

my $newimg = $img->matrix_transform(
matrix=>[ -1, 0, $img->getwidth-1,
0, 1, 0,
0, 0, 1 ]);

transform

The transform() function can be used to generate spatial warps and rotations and such effects. It only operates on a single image and its only function is to displace pixels.

It can be given the operations in postfix notation or the module Affix::Infix2Postfix can be used to generate postfix code from infix code. Look in the test case t/t55trans.t for an example.
transform() needs expressions (or opcodes) that determine the source pixel for each target pixel. Source expressions are infix expressions using any of the +, -, *, / or ** binary operators, the - unary operator, ( and ) for grouping and the sin() and cos() functions. The target pixel is input as the variables x and y.

You specify the x and y expressions as xexpr and yexpr respectively. You can also specify opcodes directly, but that's magic deep enough that you can look at the source code.

Requirements:
Perl

Imager::Engines 0.54 search tags