if ($creer) { $im = $image["fonction_imagecreatefrom"]($im); $im_ = imagecreatetruecolor($x_i, $y_i); @imagealphablending($im_, false); @imagesavealpha($im_,true); $color_t = ImageColorAllocateAlpha( $im_, 255, 255, 255 , 127 ); imagefill ($im_, 0, 0, $color_t); for ($x = 0; $x < $x_i; $x++) { for ($y=0; $y < $y_i; $y++) { $rgb = ImageColorAt($im, $x, $y); $a = ($rgb >> 24) & 0xFF; $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $g = round(($r+$g+$b) / 3); if ($g >= $deb AND $g <= $fin) $color = ImageColorAllocateAlpha( $im_, $dr, $dv, $db , $a ); else $color = ImageColorAllocateAlpha( $im_, 0, 0, 0 , 127 ); imagesetpixel ($im_, $x, $y, $color); } } $image["fonction_image"]($im_, "$dest"); }