Page 1 of 1

PHP image transparency tolerance

Posted: Fri Mar 17, 2006 3:32 pm
by Pineriver
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I've got this to join 2 images together and replace the color blue from TrueColor.jpg with BackGround.jpg.
This works but there are a few blue sploches because not all blue is truely blue. So what I am looking for is a way to bring the blue tolerance up to cover the image. Both images must be a jpeg image and not png or gif.

Code: Select all

$image = ImageCreateFromJPEG("BackGround.jpg");
$icon = ImageCreateFromJPEG("TrueColor.jpg");


$trans = imageColorallocate($image, 0,0,255);
ImageColorTransparent($icon,$trans);
$width = ImageSX($icon);
$height = ImageSY($icon);


ImageCopyResized($image,$icon,0,0,0,0,$width,$height,$width,$height);
thanks


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Fri Mar 17, 2006 3:33 pm
by hawleyjr
Moved to: PHPGD.com