I had been using PerlMagick to compose one image over another using v6.7.2-7 2017-03-22 Q16.
I updated to v7.0.8-17 Q16 and the syntax seems to have changed and I can not longer get the same results.
This sample code below give me an image that looks like this https://imgur.com/KngWDnS. There is no blend or opacity in the overlaid image and something is wrong with the dimensions. This script tries to write out a GIF, the requirement is for a jpeg.
Code: Select all
use v5.22;
use warnings;
use Image::Magick;
my $backgrd = 'dragon_sm.gif';
my $image = Image::Magick->new(Verbose => 1);
print STDERR $image->Get('version')."\n";
my $x = $image->Read($backgrd);
warn $x if $x;
my $overlay = 'star.gif';
my $wm = Image::Magick->new(Verbose => 1);
$x = $wm->Read($overlay);
warn $x if $x;
my %blend = (
image => $wm,
compose => 'blend',
#blend => "20", # V6.7
blend => '20,80', # v7.0
gravity => 'Center',
);
$image->Set(alpha => 'Set');
$x = $image->Composite( %blend );
warn $x if $x;
my $out = '/tmp/compose-test_' . $blend{blend} .'.gif';
$x = $image->Write(filename => $out);
warn $x if $x;
Code: Select all
convert dragon_sm.gif star.gif -compose blend -gravity center -define compose:args=20,80 -composite /tmp/dragon-star-file.jpg
Does anyone know what the correct syntax or give any pointers on turning command-line syntax to perl?
Thanks
Dermot