Snippets - GD

Snippets index page

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.

  1. <?php  
  2.   $image imagecreatefromjpeg"input.jpg" );
  3.   imagefilter$imageIMG_FILTER_GRAYSCALE$args );
  4.   imagejpeg$image'output.jpg' );
  5.   imagedestroy$image );
  6. ?>
http://uk.php.net/manual/en/function.imagefilter.php

For more examples and information check out the main Imagemagick section.

Change a png to a jpg View

Create some text as an image View

Crop an image View

Display image without saving View

Grayscale image View

Resize an image View

Rotate an image View

Watermark an image View