FLXCode Posterize Image

FLXCode apps

Appearance

Posterize Image

Open a picture and drag the levels down. Smooth tones break into flat bands, like a screen print.

or drop it here, or paste with Ctrl+V

JPG, PNG, WebP, HEIC, AVIF, GIF and BMP, up to 25 megapixels. Nothing is uploaded.

Works offline: load this page, edit one picture, turn off Wi-Fi, edit more. A JPG has no see-through areas, so they turn white.

Nothing you open or type is uploaded. How we count What this tool keeps and sends.

Problem or idea? Email us

How to posterize a picture

  1. Choose a picture, or drop or paste one.
  2. Start with "Poster, 4 levels". Fewer levels give flatter areas and harder edges.
  3. Switch "How to cut" to bits kept if you want what Pillow and some other tools do.
  4. Press Save as PNG. PNG keeps flat colours clean, JPG blurs the edges between them.

What posterize does to a value

Each channel is cut on its own. With n levels, the allowed values are evenly spaced from 0 to 255 with a step of 255 divided by n minus 1. For 4 levels that is 0, 85, 170, 255. A value moves to the nearest allowed one, so the cut points sit half a step apart: for 4 levels at 42.5, 127.5 and 212.5. In the table, 40 stays 0 and 43 jumps to 85.

Three channels with n levels each give n × n × n colours. 2 levels give 8 colours, 4 give 64, 8 give 512.

Bits mode keeps only the top k bits of the byte and zeroes the rest, which is a bitwise AND with a mask. 2 bits leave 0, 64, 128 and 192. Notice the top is 192, not 255: white turns grey. That is why Levels mode is the default here, it always reaches 0 and 255.

Pixel #3A7BD5 with 4 levels becomes #5555FF. Alpha is not touched.

step = 255 / (n - 1)

new = round( round(v / step) × step ) levels mode

new = v AND mask, mask = top k bits set bits mode (k = 2: 11000000)

colours = n × n × n

Seven values, six settings

One channel value in, what comes out. The numbers come from the same code as the tool, run when this page was built.

Value2 levels3 levels4 levels6 levels2 bits3 bits
0000000
4000051032
43008551032
1000128851026496
128255128170153128128
200255255170204192192
255255255255255192224

In bits mode 255 ends on 192 with 2 bits and 224 with 3 bits. In levels mode 255 always stays 255.

What it can not do

  • Each channel is cut separately, so grey areas can pick up a colour tint. A pure grey stays grey only when its three values fall in the same band.
  • It does not pick the best colours for a picture. For a fixed small palette, use a palette or dither tool.
  • It cuts a smooth sky into bands on purpose. There is no smoothing or dithering to hide them.
  • Up to 25 megapixels. A JPG is saved at quality 92 and has no see-through areas.

Next: make it grey first · paint the flat areas with a colour ramp · make the file smaller

FAQ

What is the difference between levels and bits?

Levels spreads n values evenly between 0 and 255, so black and white stay. Bits keeps the top k bits, so values snap down and the top value is below 255. 3 bits give 8 values per channel, topping out at 224.

How many colours do I get?

The number of levels cubed, at most. 4 levels give 64 colours, but a real picture often uses fewer, because not every combination appears.

Why did my file get bigger as a JPG?

Hard edges between flat areas are the thing JPG handles worst. It adds noise around them. Save as PNG and it is usually smaller than the JPG. A PNG original may not shrink.

Does it match Photoshop Posterize?

Not checked here. The bits mode is the same as Pillow ImageOps.posterize, tested on a 16 by 16 picture. Photoshop has its own levels rule and I did not compare.

Can I get a black and white picture with it?

Make the picture grey first, then posterize with 2 levels. Every pixel is then black or white.

More from FLXCode

  • Grayscale ImageTurn a picture grey with Rec. 709, Rec. 601, linear light or one channel. Save as PNG or JPG. Nothing is uploaded.
  • Gradient Map and DuotoneColour a picture by brightness with 2 to 5 colours. Two make a duotone. PNG or JPG. Nothing is uploaded.
  • Compress ImageCompress JPG, PNG and WebP by quality or target KB, with a side-by-side preview. Nothing is uploaded.
  • Image ResizerResize photos by pixels, percent or preset for Instagram and email. Batch and zip. Nothing is uploaded.

Share Posterize Image