нашел
function imagesaturation($im){
$L = imagesx($im);
$H = imagesy($im);
for($j=0;$j<$H;$j++){
for($i=0;$i<$L;$i++){
$rgb = imagecolorat($im, $i, $j);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
$getArrayHSB = RGBtoHSB($r,$g,$b);
$saturation = 0.7; //[0-2]
$getArrayHSB[1] = $saturation*$getArrayHSB[1];
$getArrayHSB[1] = max(0.0,min($getArrayHSB[1],1.0));
$getArrayRGB = HSBtoRGB($getArrayHSB[0],
$getArrayHSB[1],$getArrayHSB[2]);
$hsbrgb = imagecolorallocate($im,
$getArrayRGB[0], $getArrayRGB[1],
$getArrayRGB[2]);
$result = (($rgb & 0xff000000)|($hsbrgb));
imagesetpixel($im, $i, $j, $result);
}
}
}
function RGBtoHSB( $r , $g , $b )
{
$r = $r/255;
$g = $g/255;
$b = $b/255;
$MAX = max($r,$g,$b);
$MIN = min($r,$g,$b);
if ($MAX == $MIN) return array(0,0,$MAX);
if ($r == $MAX) $HUE = ((0 + (($g - $b)/($MAX-$MIN))) * 60);
elseif ($g == $MAX) $HUE = ((2 + (($b - $r)/($MAX-$MIN))) * 60);
elseif ($b == $MAX) $HUE = ((4 + (($r - $g)/($MAX-$MIN))) * 60);
if ( $HUE < 0 ) $HUE += 360;
return array($HUE,(($MAX - $MIN)/$MAX),$MAX);
}
function HSBtoRGB( $H , $S , $V )
{
if ($S == 0) return array($V * 255,$V * 255,$V * 255);
$Hi = floor($H/60);
$f = (($H/60) - $Hi);
$p = ($V * (1 - $S));
$q = ($V * (1 - ($S * $f)));
$t = ($V * (1 - ($S * (1 - $f))));
switch ( $Hi )
{
case 0 : $red = $V; $gre = $t; $blu = $p; break;
case 1 : $red = $q; $gre = $V; $blu = $p; break;
case 2 : $red = $p; $gre = $V; $blu = $t; break;
case 3 : $red = $p; $gre = $q; $blu = $V; break;
case 4 : $red = $t; $gre = $p; $blu = $V; break;
case 5 : $red = $V; $gre = $p; $blu = $q; break;
default : exit("error -- invalid parameters\n\n");
}
return array(round($red * 255),round($gre * 255),round($blu * 255));
}