Re: [GD-DEVEL] Color Overlay

[email protected] (Pierre)
Newsgroups php.gd.devel
Message-ID <[email protected]>
On 9/10/07, Jason Hart <[email protected]> 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
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.