Back to the snippets index

Grayscale image ( Anthony 23/6/2008 )

Use a filter to change an image to grayscale. There are other filters check the link below. Note: needs php 5.

GD code:

imagecreatefromjpeg"input.jpg" );
imagefilter$imageIMG_FILTER_GRAYSCALE$args );
imagejpeg$image'output.jpg' );
imagedestroy$image );

Link for more information

Change a png to a jpg
Create some text as an image
Crop an image
Display image without saving
Grayscale image
Resize an image
Rotate an image
Watermark an image