in reply to Setting opacity with dissolve in perlmagick

For some reason the opacity is being ignored

It would be nice if you posted a runnable code example, so we can test. Image and Text Watermarked Letters might have some clues for you. FWIW, PerlMagick's syntax can be tricky. From a quick look at it, compared to my watermark code, it looks like you are missing a % sign.

opacity => '87.8' should be '87.8%'

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Setting opacity with dissolve in perlmagick
by shohn (Novice) on May 28, 2012 at 10:47 UTC

    Hi, thanks for the reply. Here's some runnable code (it's the closest I can get to how I need my image to look):

    use Image::Magick; use strict; my $mask = Image::Magick->new(magick=>'png'); my $background = Image::Magick->new(magick=>'png'); my $foreground = Image::Magick->new(magick=>'png'); $mask->Read("png:mask.png"); $background->Set(size=>'500x500'); $background->Read("xc:white"); $background->Set(magick=>'png'); $foreground->Read("foreground.jpg"); $foreground->Set(magick=>'png'); $background->Composite(compose=>'Dissolve', opacity => '87.8%', image= +>$foreground); $background->Composite(image=>$mask); $background->Write("output.png"); exit;

    I've had to go round adding 'png' all over the place in attempt to get it working. The mask can be any png with transparency (any kind of watermark), and foreground any 500x500 image.