d
Amit DhamuSoftware Engineer
 

GD Image Filters

1 minute read 00000 views
$image = imagecreatefrompng("demo.png");

// Black and White
imagefilter($image, IMG_FILTER_GRAYSCALE);
imagepng($image, "demo-blackandwhite.png");
imagedestroy($image);

// Negative
imagefilter($image, IMG_FILTER_NEGATE);
imagepng($image, "demo-negative.png");
imagedestroy($image);

// Sepia
imagefilter($image, IMG_FILTER_GRAYSCALE);
imagefilter($image, IMG_FILTER_COLORIZE,100,50,0);
imagepng($image, "demo-sepia.png");
imagedestroy($image);