Posterization filter explained?

Here is the Processing implementation of POSTERIZE.

The input param / levels is used to bin each channel into colors, and levels must be between 2 and 255. Levels is levels per channel – each channel is extracted, multiplied by the desired number of levels to create higher bits for the levels, then shifted right to eliminate differences between groups in the original lower bits, before being divided and written back into each channel.

There is no choosing color / clustering / etc. – the level input to this process always creates a uniform subdivision of each 8bit color channel into however many groups – 2, 8, 32, et cetera.

This can be used in filter(POSTERIZE, mylevels) directly, or called on a PImage / PGraphics object.

2 Likes