1

I am using the following code.

$im = imagecreatefrompng('1.png');
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagefilter($im, IMG_FILTER_CONTRAST, -40);
....
imagedestroy($im);

Now, I have to create the image again to apply different filter.

$im = imagecreatefrompng('1.png');
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagefilter($im, IMG_FILTER_COLORIZE, 100,50,0);
....
imagedestroy($im);

Do i need to destroy and create that image every time to apply a new effect? Or can we use it by removing the previous filter?

Mahesh
  • 1,503
  • 3
  • 22
  • 33
  • You will have to "clone" the GD resource before applying the filter, maybe something like this http://stackoverflow.com/a/32363287/179545 – unloco Feb 07 '16 at 18:19

0 Answers0