Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Setting opacity with dissolve in perlmagick

by shohn (Novice)
on May 28, 2012 at 10:47 UTC ( [id://972811]=note: print w/replies, xml ) Need Help??


in reply to Re: Setting opacity with dissolve in perlmagick
in thread Setting opacity with dissolve in perlmagick

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://972811]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found