Re: [GD-DEVEL] re: Blending images with alpha (patches inside)

[email protected] (patrick keshishian)
Newsgroups php.gd.devel
Message-ID <[email protected]>
Hi Ethan,

On Sun, Aug 19, 2007 at 08:50:28PM -0700, Ethan A Merritt wrote:
> On Sunday 19 August 2007 20:34, patrick keshishian wrote:
> > 
> > What I was trying to accomplish with my patch was to provide for
> > a method by which the user/programmer could change the level of
> > opacity of a source image at run-time.
> 
> If I understood correctly, your watermark image is transparent
> everywhere except for the watermark itself.  In this case can you
> not use the function


Actually, my watermark is a true-colour image, with anti-alias
info.


>    gdImageCopyMerge(..., pct)
> where pct is the multiplier for the alpha channel value of the
> watermark itself?
> 
> 	Ethan
> 
> 
> 
> > 
> > Something like this Perl code snippet:
> > 
> >     my $iw = GD::Image-&gt;new('circ.png'); # Watermark image
> >     my $is = GD::Image-&gt;new('test_in.jpg');
> >     # ... Set up vars
> >     # Blend the watermark at 100%, 65%, 35% and 10% opacities.
> >     $is->blend($iw, $dx, $dy, $sx, $sy, $sw, $sh, 100);
> >     $is->blend($iw, $dx + $sw, $dy, $sx, $sy, $sw, $sh, 65);
> >     $is->blend($iw, $dx, $dy + $sh, $sx, $sy, $sw, $sh, 35);
> >     $is->blend($iw, $dx + $sw, $dy + $sh, $sx, $sy, $sw, $sh, 10);
> >     # ... Write resulting image.
> > 
> > 
> > This will blend the watermark image onto the the test_in.jpg
> > four times, in four quadrants at four different opacity levels.
> > 
> > Here is the result from the code:
> > 
> > 	http://sidster.org/code/gd/gd_blend_test.jpg
> > 
> > Best,
> > --patrick
> > 
> 
> -- 
> Ethan A Merritt
> Biomolecular Structure Center
> University of Washington, Seattle 98195-7742
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.