Return to Snippet

Revision: 17303
at August 31, 2009 12:14 by hasantayyar


Initial Code
//to black and white
if(!file_exists('dw-bw.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_GRAYSCALE);
	imagepng($img,'db-bw.png');
	imagedestroy($img);
}

//to negative
if(!file_exists('dw-negative.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_NEGATE);
	imagepng($img,'db-negative.png');
	imagedestroy($img);
}


//to Sepia
if(!file_exists('dw-sepia.png')) {
	$img = imagecreatefrompng('dw-manipulate-me.png');
	imagefilter($img,IMG_FILTER_GRAYSCALE);
	imagefilter($img,IMG_FILTER_COLORIZE,100,50,0);
	imagepng($img,'db-sepia.png');
	imagedestroy($img);
}

Initial URL
http://davidwalsh.name/php-image-filter

Initial Description


Initial Title
Image Manipulation with PHP and the GD Library

Initial Tags


Initial Language
PHP