White Edges on Watermarks

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
iyoung
Posts: 2
Joined: 2014-06-27T03:38:11-07:00
Authentication code: 6789

White Edges on Watermarks

Post by iyoung »

Hi all, I am using PerlMagick and ImageMagick 6.7 to add a watermark to images. From the commandline on the same server using the following command the image is watermarked correctly without any white edges.

composite -gravity southwest -dissolve 50 /esp/data/watermark.png preview.jpg test.jpg

Image

Using the following code in Perl I get a jagged white edge: -

#!/usr/bin/perl
use Image::Magick;
my $wmarkimg = Image::Magick->new;
my $obj = Image::Magick->new;
$wmarkimg->ReadImage('png:watermark.png');
$obj->ReadImage('preview.jpg');
$obj->Composite(image=>$wmarkimg,compose=>'Dissolve',gravity=>'SouthWest',opacity=>'50%');
$obj->write('test2.jpg');
1;

Image

I've spent the whole morning changing a whole range of the options on Composite and searching for anyone with a similar issue but have got no where.
iyoung
Posts: 2
Joined: 2014-06-27T03:38:11-07:00
Authentication code: 6789

Re: White Edges on Watermarks

Post by iyoung »

Discovered the solution here: -

http://stackoverflow.com/questions/1456 ... rent-image

Code: Select all

$watermark->Evaluate(
  operator => 'Multiply',
  value    => 0.6,
  channel  => 'Alpha',
);

$background->Composite(
  image    => $watermark,
  gravity  => 'Center',
);
Post Reply