Re: [GD-DEVEL] Color Overlay
| From: | Pierre | Date: | Tue, 11 Sep 2007 12:49:45 +0000 |
| Subject: | Re: [GD-DEVEL] Color Overlay | ||
| References: | 1 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-258@lists.php.net to get a copy of this message | ||
On 9/10/07, Jason Hart <runey71@gmail.com> wrote:
> I was hoping to someone could help me find a way to simulate the 'Color
> Overlay' feature from Photoshop using only the GD Library...
>
> Basically I have a transparent overlay that I want to place over a
> background image...
> This is so I can fade the edges of that image to the background color of the
> page...
> This I've already done...
>
> However the overlay image is a set color, black in this case...
> I need to be able to change it under certain circumstances to match the page
> color...
>
> To change this in Photoshop I would just go to blending options -> color
> overlay and select a different color...
>
> I was hoping to find a way of doing this using the GD Library instead...
>
> The overlay picture can be found here...
> http://trekcon.com/overlay/overlay.png
> The background picture can be found here...
> http://trekcon.com/overlay/background.jpg
> The result can be found here...
> http://trekcon.com/overlay/composite.jpg
> The code can be found here...
> http://trekcon.com/overlay/watermark.php
>
> Hopefully what I'm asking makes sense :)
Using imagecopy, it works well here:
http://blog.thepimp.net/misc/a.jpeg
and the script:
$im = imagecreatefromjpeg("background.jpg");
$wm = imagecreatefrompng("overlay.png");
$wm_w = imagesx($wm);
$wm_h = imagesy($wm);
imagecopy($im, $wm, 0, 0, 0, 0, $wm_w, $wm_h);
imagejpeg($im, '/home/web/blog.thepimp.net/pages/misc/a.jpeg');
Please try using the latest php version (with the bundled GD). It
should work as expected.
Cheers,
--Pierre