Re: [GD-DEVEL] re: Blending images with alpha (patches inside)
| From: | patrick keshishian | Date: | Tue, 21 Aug 2007 03:19:03 +0000 |
| Subject: | Re: [GD-DEVEL] re: Blending images with alpha (patches inside) | ||
| References: | 1 2 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-248@lists.php.net to get a copy of this message | ||
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->new('circ.png'); # Watermark image
> > my $is = GD::Image->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