function image_saturer($im, $sat=1) { $image = valeurs_image_trans($im, "saturer-$sat"); if (!$image) return(""); $x_i = $image["largeur"]; $y_i = $image["hauteur"]; $im = $image["fichier"]; $dest = $image["fichier_dest"]; $creer = $image["creer"]; 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; if ($a < 127) { $hsv = image_rgb2hsv($r,$g,$b); $h = $hsv["h"]; $s = $hsv["s"]; $v = $hsv["v"]; $s = $s * $sat; $s = min($s,1); $rgb = image_hsv2rgb($h,$s,$v); $r = $rgb["r"]; $g = $rgb["g"]; $b = $rgb["b"]; } $color = ImageColorAllocateAlpha( $im_, $r, $g, $b , $a ); imagesetpixel ($im_, $x, $y, $color); } } $image["fonction_image"]($im_, "$dest"); } $class = $image["class"]; if (strlen($class) > 1) $tags=" class='$class'"; $tags = "$tags alt='".$image["alt"]."'"; $style = $image["style"]; return ""; }