Perl Image::Magick: place an image on the top of an other image

1.4k Views Asked by At

I have two images (the first one is big and the second one is small and transparent). I need to add the second image at the center of the first image and save the result as a new file.

How to do it with Perl Image::Magick?

1

There are 1 best solutions below

0
On
use strict;
use warnings;
use Image::Magick;

my $big = Image::Magick->new;
$big->Read(filename => 'big.png');

my $little = Image::Magick->new;
$little->Read(filename => 'little.png');

$big->Composite(image => $little, qw(compose SrcAtop  gravity Center));

$big->Write(filename => 'out.png');