Code: Select all
#!/bin/bash
composite -compose plus image.png mask.png image_mask0.png
I tried three times to write it using Perl and the Image:: Magick:
Code: Select all
#!/usr/bin/perl -w
use strict;
use Image::Magick;
my $im_x;
$im_x=Image::Magick->new;
my $x=$im_x->Composite(compose=>"Plus", image=>"image.png", mask=>"mask.png");
warn "$x" if "$x";
$im_x->Write("image_mask1.png");
undef $im_x;
Code: Select all
#!/usr/bin/perl -w
use strict;
use Image::Magick;
my $im_x;
$im_x=Image::Magick->new;
my $x=$im_x->Composite(compose=>'Plus', image=>'image.png', mask=>'mask.png');
warn "$x" if "$x";
$im_x->Write("image_mask2.png");
undef $im_x;
Code: Select all
#!/usr/bin/perl -w
use strict;
use Image::Magick;
my $image=Image::Magick->new;
$image->Read("image.png");
my $mask =Image::Magick->new;
$mask->Read("mask.png");
my $im_x;
$im_x=Image::Magick->new;
my $x=$im_x->Composite(compose=>'Plus', image=>$image, mask=>$mask);
warn "$x" if "$x";
$im_x->Write("image_mask3.png");
$image->Write("image3.png");
$mask->Write("mask3.png");
undef $im_x;
undef $image;
undef $mask;
Exception 410: no images defined `Composite' @ error/Magick.xs/XS_Image__Magick_Mogrify/7336 at ./compose_test1.pl line 9 (or 15).
and image_mask.png files are not created.
I use perl-PerlMagick 6.6.5.8-7.3, ImageMagick 6.6.5.8-7.3, Perl 5.12.3-11.14.1 on openSUSE 11.4.
What am I doing wrong?