note 30094 added to function.imagecolortransparent

From: Date: Thu, 06 Mar 2003 05:04:24 +0000
Subject: note 30094 added to function.imagecolortransparent
Groups: php.notes 
Request: Send a blank email to php-notes+get-44920@lists.php.net to get a copy of this message
here's a little snippet of code that i got for getting images to overlay with transparency(based off text overlay above). $olay_img = imagecreatefromPNG("overlay.png); //NOTE I recomment you use png for this, artifacts from jpeg images can look bad when you overlay them $src_img = ImageCreateFromJPEG("image.jpg"); $src_w = ImageSX($src_img); $src_h = ImageSY($src_img); $can_img = imagecreatetruecolor($src_w, $src_h); $black = ImageColorAllocate ($olay_img, 0, 0, 0); ImageColorTransparent($olay_img, $black); imagecopy($can_img, $src_img, 0,0,0,0, $src_w, $src_h); imagecopymerge($can_img, $olay_img, 0,0,0,0, ImageSX($olay_img), ImageSY($olay_img),100); //Imagecopy won't work, you must used imagecopymerge ImageJPEG($can_img,'',100); imagedestroy($src_img); imagedestroy($olay_img); imagedestroy($can_img); -- http://www.php.net/manual/en/function.imagecolortransparent.php http://master.php.net/manage/user-notes.php?action=edit+30094 http://master.php.net/manage/user-notes.php?action=delete+30094 http://master.php.net/manage/user-notes.php?action=reject+30094

« previous php.notes (#44920) next »