I know you can apply PNG filters, like PNG_FILTER_UP to the imagepng() function, but how can I reverse that output. Is there a function to undo the filter?

Accepted Answer

There's no need to undo anything. The "filter" specifies one of the five possible error prediction filters used internally by the PNG encoding algorithm. The decoder discovers it (the stream includes the info about what filter was used for each line) and it can decode the image, and that's all. Perhaps you are thinking of the "filter" as some kind of image processing, but it's not, it does not alter the image at all.

Written by leonbloy
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki