I wanna convert an colored image to grayscale, i am using the below mentioned code.
<?php
header ('Content-type: image/jpeg');
// Load the target image
$rDestImg = imagecreatefromjpeg('test.jpg');
// Create a blank source image
$rSourceImg = ImageCreate (0,0);
// Merge the source with the destination
ImageCopyMergeGray ($rDestImg, $rSourceImg, 0, 0, 0, 0, imageSX($rDestImg), imageSY($rDestImg), 0);
// Print the image to the browser
Imagejpeg($rDestImg);
?>
But i get an error on the imagecreate line saying invalid width or my whole php crashes . I am on a win2k machine, IIS, php 4.3.0 with GD 2.0.
Kindly Help!!