It is desirable that the gradient
remained, and the contrast
too has not changed. That is, all the same, only solid colors and the gradient (where it exists), and on the borders of regular (not sharp) transition in 1 pixel. On this picture is white, black, brown, and the gradient from blue to orange, plus halftone of 1 pixel at the borders between colors.
Maybe there are already ready decisions - the filters that can, really? If not, what algorithm
is better to use to create your own filter? Or combination of algorithms?