note 77098 deleted from function.imagecolortransparent by nlopess

From: Date: Wed, 15 Aug 2007 12:19:26 +0000
Subject: note 77098 deleted from function.imagecolortransparent by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-129492@lists.php.net to get a copy of this message
Note Submitter: Mikasto ---- To resize transparent PNG (if image is transparent & ImageColorTransparent() returns -1): 1) create a new image with the new sizes 2) make the new image all transparent 3) turn off the alpha blending for the new image (to keep the alpha channel when copy data) 4) do copyresampled or copyresized into new image PHP code: // 1 $im2 = ImageCreateTrueColor($w, $h); // 2 ImageColorTransparent($im2, ImageColorAllocate($im2, 0, 0, 0)); // 3 ImageAlphaBlending($im2, false); // 4 ImageCopyResampled($im2, $im, 0, 0, 0, 0, $w, $h, ImageSX($im), ImageSY($im)); or see this http://alexle.net/archives/131

« previous php.notes (#129492) next »