How can I programatically evaluate each pixel before final composition? I'm using a complex compositor node setup, which in the end reduces the image to just a few solid colors. I would like to remove any pixels from the image which have no pixels of the same color in the 8 surrounding pixels (and replace them with whatever color is most common in those 8 pixels). I don't want to affect any of the other pixels.
Is there any method within the compositor I could use to do this?
An example of a pixelated image in the compositor.  This may help for one part of your question.