overlaying alpha channel png over jpeg

From: Date: Mon, 27 Aug 2001 11:40:45 +0000
Subject: overlaying alpha channel png over jpeg
Groups: php.general 
Request: Send a blank email to php-general+get-64616@lists.php.net to get a copy of this message
I hope someone has got solution for this: I'm trying to write a script which will watermark a jpeg file with png logo, and output the resulting jpeg to a file. Unfortunately, whatever I do, I'm unable to get transparent color in png to disappear, by any means. the png file is 8bit, jpeg is true color; Am I doing something wrong? have a look: <? $sourcefile="test2.jpg"; $insertfile="peoplestamp.png"; $targetfile="test.jpg"; $transition=50; $insertfile_id = imageCreateFromPNG($insertfile); $sourcefile_id = imageCreateFromJPEG($sourcefile); $sourcefile_width=imageSX($sourcefile_id); $sourcefile_height=imageSY($sourcefile_id); $insertfile_width=imageSX($insertfile_id); $insertfile_height=imageSY($insertfile_id); $dst = imageCreateTrueColor($sourcefile_width,$sourcefile_height); imagealphablending($dst,TRUE); imagecopy($dst,$sourcefile_id,0,0,0,0,$sourcefile_width,$sourcefile_height); $aaa=imagecolorresolvealpha($insertfile_id,255,255,255,255); imagecolortransparent($insertfile_id,$aaa); imageCopyMerge($dst, $insertfile_id,0,0,0,0,$insertfile_width,$insertfile_height,$transition); imagepng ($dst,"$targetfile"); ?> <img src="<?=$targetfile?>" border=0> Best regards, -- Vahan Yerkanian vp.technical@abideweb.com Vice President, Design & Development Website @ http://www.abideweb.com/ AbideWeb Technologies, LLC Phone +3741 238650 | Mobile +3749 416358

« previous php.general (#64616) next »