Re: overlaying alpha channel png over jpeg

From: Date: Thu, 30 Aug 2001 09:37:34 +0000
Subject: Re: overlaying alpha channel png over jpeg
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-65245@lists.php.net to get a copy of this message
If I were doing this, I would attempt to un-set the PNG transparency right after loading in the PNG... But I wouldn't know an alpha channel if it bit me :-) -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Vahan Yerkanian <VP.Technical@abideweb.com> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Monday, August 27, 2001 6:40 AM Subject: overlaying alpha channel png over jpeg > 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 (#65245) next »