2

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?

Borodin
  • 126,100
  • 9
  • 70
  • 144
porton
  • 5,214
  • 11
  • 47
  • 95

1 Answers1

7
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');
cjm
  • 61,471
  • 9
  • 126
  • 175