Posterize Image
Open a picture and drag the levels down. Smooth tones break into flat bands, like a screen print.
https://flxcode.com/posterize-image/
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
- Choose a picture, or drop or paste one.
- Start with "Poster, 4 levels". Fewer levels give flatter areas and harder edges.
- Switch "How to cut" to bits kept if you want what Pillow and some other tools do.
- 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.
| Value | 2 levels | 3 levels | 4 levels | 6 levels | 2 bits | 3 bits |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 40 | 0 | 0 | 0 | 51 | 0 | 32 |
| 43 | 0 | 0 | 85 | 51 | 0 | 32 |
| 100 | 0 | 128 | 85 | 102 | 64 | 96 |
| 128 | 255 | 128 | 170 | 153 | 128 | 128 |
| 200 | 255 | 255 | 170 | 204 | 192 | 192 |
| 255 | 255 | 255 | 255 | 255 | 192 | 224 |
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.