note 55974 deleted from function.imagefilter by victor

From: Date: Fri, 19 Aug 2005 19:41:46 +0000
Subject: note 55974 deleted from function.imagefilter by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93914@lists.php.net to get a copy of this message
Note Submitter: puremango dot co dot uk at gmail dot com ---- image blur for PHP<5: <? function myImageBlur($im,$distance=1) { // w00t. my very own blur function $width = imagesx($im); $height = imagesy($im); $temp_im = ImageCreateTrueColor($width,$height); $bg = ImageColorAllocate($temp_im,150,150,150); // preserves transparency if in orig image ImageColorTransparent($temp_im,$bg); // fill bg ImageFill($temp_im,0,0,$bg); // blur by merging with itself at different x/y offsets: for($i=1 ; $i<=$distance ; $i++) { ImageCopyMerge($temp_im, $im, 0, 0, 0, $i, $width, $height-$i, 70); ImageCopyMerge($im, $temp_im, 0, 0, $i, 0, $width-$i, $height, 70); ImageCopyMerge($temp_im, $im, 0, $i, 0, 0, $width, $height, 70); ImageCopyMerge($im, $temp_im, $i, 0, 0, 0, $width, $height, 70); } // remove temp image ImageDestroy($temp_im); return $im; } ?> MyImageBlue($im); will just fuzz the image, but using the optional $distance parameter, you blur by larger amounts It's not the fastest function you'll ever see, but I hope it helps. for more such wonders, check out http://www.puremango.co.uk

« previous php.notes (#93914) next »