01 <?php
02
03 function create_grey($input,$output)
04 {
05 $bild = imagecreatefromjpeg($input);
06 $x = imagesx($bild);
07 $y = imagesy($bild);
08
09 for($i=0; $i<$y; $i++)
10 {
11 for($j=0; $j<$x; $j++)
12 {
13 $pos = imagecolorat($bild, $j, $i);
14 $f = imagecolorsforindex($bild, $pos);
15 $gst = $f['red']*0.15 + $f['green']*0.5 + $f['blue']*0.35;
16 $col = imagecolorresolve($bild, $gst, $gst, $gst);
17 imagesetpixel($bild, $j, $i, $col);
18 }
19 }
20 imagejpeg($bild,$output,90);
21 }
22
23 ?>