function MakeColoursGrey($im,$col){ for($i=0;$i<$total;$i++){ #trying to keep proper saturation when converting $commongrey=(int)($old['red']+$old['green']+$old['blue'])/3; if(!$col){ }elseif($col==1){ }elseif($col==2){ }elseif($col==3){ } } } #change the colours to grey MakeColoursGrey($img,$col); #send the http header, this outputs an image of type gif #send the image