How to posterize a texture in cycles proceduraly?
I think six math nodes do the trick.


I separate the image texture into R, G and B
Then I use a math node to perform a modulo division. It divides the input by a value and keeps the rest. 100 modulo 30 = 10. Here, 0.845 modulo 0.1 is 0.045
Next step, I subtract the result from the original value with another set of math nodes: 0.845 - 0.045 = 0.800
I join the RGB values and feed them into the shader.
I added a value node that tells all 3 modulo nodes which value to use. 0.0 means the original image, 0.1 uses ten steps, 0.2 uses 5 steps.




Not totally happy with the result though. I bet there'll be a better answer soon. Below has a value of 0.2



I made two improvements afterwards. I packed it into a node group which means the value node isn't necessary anymore. The input of the group does it nicely.

Under the hood I divided the factor in half and added it to the RGB values to simulate rounding. That should result in a brighter image closer to the original.



Collapsed it turns into this: