| AND OR | string words | *

image editing

|

grayscale an image


converts an image into greyscale


function create_grey( ) [ line 2 ]



full source of grayscale an image [ line 1 - 20 ] | download grayscale an image

1    <?php
2   function create_grey($input,$output)
3   {
4    $bild imagecreatefromjpeg($input);
5    $x imagesx($bild);
6    $y imagesy($bild);
7    for($i=0$i<$y$i++)
8    {
9     for($j=0$j<$x$j++)
10     {
11      $pos imagecolorat($bild$j$i);
12      $f imagecolorsforindex($bild$pos);
13      $gst $f["red"]*0.15 $f["green"]*0.5 $f["blue"]*0.35;
14      $col imagecolorresolve($bild$gst$gst$gst);
15      imagesetpixel($bild$j$i$col);
16     }
17    }
18    imagejpeg($bild,$output,90);
19   }
20   ?>



56 hits by 19 users in the last 30 minutes.