Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP GD: Blur for transparent image
    primarykey
    data
    text
    <p>I am trying to create the silhouette of PNG image with transparencies. Here is my code</p> <pre><code> //file that i am working with $file='http://www.google.com/mapfiles/turkey.png'; $im =imagecreatefrompng($file); imagealphablending($im, false); imagesavealpha($im, true); $imw =imagesx($im); $imh =imagesy($im); //turkey body color $bodycolor=imagecolorallocatealpha($im, 144, 144, 144, 50); //imageholder $imnew =imagecreatetruecolor($imh, $imh); imagealphablending($imnew, false); imagesavealpha($imnew, true); $transparent_color=imagecolorallocatealpha($imnew, 0, 0, 0, 127); imagecolortransparent($imnew, $transparent_color); imagefilledrectangle($imnew, 0, 0, $imh, $imh, $transparent_color); for ($i=0; $i > 24; //all not transparent pixels are copied to imageholder if ($alpha != 127) { imagesetpixel($imnew, $i, $j, $bodycolor); } } } //blur filter imagefilter($imnew, IMG_FILTER_GAUSSIAN_BLUR); imagefilter($imnew, IMG_FILTER_GAUSSIAN_BLUR); imagefilter($imnew, IMG_FILTER_GAUSSIAN_BLUR); header ("Content-type: image/png"); imagepng ($imnew); imagedestroy ($imnew); ?> </code></pre> <p>So, I need to get the silhouette ot the turkey with blurred edges. What I get now looks like <a href="http://yfrog.com/5edownloadnap" rel="nofollow noreferrer" title="this">link text</a>. I need edges to be blurred "outside", so the farther the pixel was from edge, the more transparent it was with the same rbg. And imagefilter also lifts the turkey a bit :) Please help, I am trying to solve this for days. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload