Set the block size to the feature you want gone, not to a feeling. On this batch 8 px rewrote 58.153% of all pixels but only 13.296% moved by more than 32 levels, and 41.847% came back byte-identical. The number that matters is not how many pixels changed, it is how many blocks were wide enough to flatten something.
Two consequences follow. A block size you copy off a screenshot will not repeat, because the grid can start anywhere: shifting the 8 px grid by half a block on a 4000 x 3000 landscape rewrote 7,171,856 pixels, 59.766% of the frame. And small blocks cost bytes, not save them: 2 px output was 21,083,992 bytes of PNG from 20,934,926 bytes of input, 1.0071 times the source.
This page treats the pixelate effect as a batch job: one block size, a folder of mixed files, a per-file account of what came out. The neighbouring measurements on the same twelve files are the threshold measurement (a level, not a block, and its count never moves), the blur measurement (a radius that softens instead of flattening), the sharpen measurement, the equalize measurement and the grayscale measurement. If you want the single-image case, start at the photo flipper.
Pixelation and threshold are the pair worth comparing, because both replace the fine detail with something coarse and both are one-number controls. Threshold throws the middle away and keeps two values; pixelation keeps every value and throws away the position. That difference is why a threshold changes the same 68.229% of this batch at every level, while pixelation changes 45.092% at 2 px and 71.341% at 100 px.
Twelve files, 20,934,926 bytes on disk and 63,016,384 pixels across the 11 that decoded. Each readable file was converted to RGB, cut into squares anchored at the top-left corner, each square replaced by the mean of its own pixels rounded to the nearest integer, and the block re-expanded to the original dimensions. No resampling filter, no colour conversion, no dithering. Nothing left the machine: Pillow 13.0.0, numpy 2.5.4 and Python 3.13.14 on Windows.
Every row below covers the same 63,016,384 pixels. What changes is how many squares they are cut into, and how many pixels each one holds. Going from 2 px to 4 px cuts the cell count by a factor of 3.9, because both the columns and the rows halve; from 64 px to 100 px it falls by 2.5, because the ratio is only 1.56.
| Block size | Pixels per cell | Cells produced | Pixels changed | Share changed |
|---|---|---|---|---|
| 2 px | 4 | 15,754,096 | 28,415,600 | 45.092% |
| 4 px | 16 | 3,938,524 | 33,688,998 | 53.461% |
| 8 px | 64 | 984,881 | 36,645,735 | 58.153% |
| 16 px | 255.1 | 246,983 | 38,920,393 | 61.762% |
| 32 px | 1,019.4 | 61,818 | 40,603,366 | 64.433% |
| 64 px | 4,036.4 | 15,612 | 42,487,015 | 67.422% |
| 100 px | 9,996.3 | 6,304 | 44,956,292 | 71.341% |
Cells produced is the sum over the eleven readable files of the columns times the rows after padding each file up to a whole number of blocks. At 16 px and above the average is not exactly the square of the block size because the small files are padded to a whole block and carry the slack.
A pixel counts as changed if a single channel moved by one level. That is not what your eye sees. Sorting the differences into two bands gives two very different pictures: at 8 px, 58.153% of pixels changed by at least one level, but 13.296% moved by 32 levels or more, and only 0.253% by 128 or more. The pixels that did not move at all are 41.847% of the batch, because most of them already sat in a flat area where the mean equals the original.
| Block size | Unchanged | Moved 1 level or more | Moved 32 or more | Moved 128 or more |
|---|---|---|---|---|
| 4 px | 46.539% | 53.461% | 8.665% | 0.063% |
| 8 px | 41.847% | 58.153% | 13.296% | 0.253% |
| 16 px | 38.238% | 61.762% | 16.973% | 0.631% |
| 32 px | 35.567% | 64.433% | 21.426% | 1.079% |
Percentages of 63,016,384 pixels. A pixel is counted in the 32 band if the largest absolute difference across its three channels is at least 32 levels, so the bands are cumulative, not exclusive.
The practical reading: at 8 px the batch looks pixelated and 58% of its pixels are technically different, but 87% of those differences are smaller than 32 levels, which is the kind of shift a viewer reads as texture rather than as blocks. If your goal is "unmistakably pixelated", 8 px may not get there on a smooth photo; if your goal is "unreadable text", 8 px is already more than enough and you have spent quality for nothing.
Averaging is anchored somewhere, and nothing in the file records where. The same 8 px applied with the grid moved half a block to the right and down rewrote 7,171,856 pixels of the 4000 x 3000 landscape, 59.766% of the frame, with 10.652% of pixels differing by 32 levels or more. On the 1600 x 900 screenshot the shift touched 66.413% of pixels, and on the 128 x 128 icon 75%, with 43.945% differing by 32 or more.
| File | Pixels | Different after half-block shift | Share | Differ by 32 or more |
|---|---|---|---|---|
| photo_landscape.jpg | 12,000,000 | 7,171,856 | 59.766% | 10.652% |
| screenshot.webp | 1,440,000 | 956,352 | 66.413% | 14.314% |
| small_icon.png | 16,384 | 12,288 | 75.000% | 43.945% |
None of this is a defect. Averaging a different set of neighbours gives a different colour, and a different colour is the correct answer for that grid. It does mean that "block size 8" is not a recipe: two tools, or the same tool after a crop, can produce two versions and both are right. If you need the same look twice, keep the output, because the input plus the number is not enough to reproduce it.
Eleven files, one number, eleven outcomes. At 8 px the spread runs from 1.333% of pixels changed on a 16-bit grayscale scan to 76.425% on a square PNG. The reason is not the format, it is how much of the picture already sits in flat areas: a scan that varies by a few levels per pixel has blocks whose average is nearly the original pixel, while a photo with strong local contrast gets every block rewritten.
| File | Pixels | Columns at 8 px | Unchanged | Moved 32 or more | Mean difference |
|---|---|---|---|---|---|
| photo_square.png | 9,000,000 | 375 | 23.574% | 18.335% | 15.651 |
| small_icon.png | 16,384 | 16 | 25.263% | 38.562% | 30.093 |
| screenshot.webp | 1,440,000 | 200 | 36.713% | 16.699% | 14.554 |
| exif_orient6.jpg | 3,000,000 | 250 | 38.933% | 16.139% | 13.682 |
| photo_landscape.jpg | 12,000,000 | 500 | 41.513% | 13.202% | 11.265 |
| gray_8bit.jpg | 12,000,000 | 375 | 50.834% | 10.011% | 8.591 |
| logo_alpha.png | 960,000 | 150 | 96.647% | 2.584% | 2.717 |
| animation.gif | 120,000 | 50 | 96.693% | 3.307% | 2.953 |
| gray_16bit.png | 480,000 | 100 | 98.667% | 0.954% | 0.726 |
Mean difference is the average of the largest per-pixel channel difference, on a 0 to 255 scale. The two byte-identical portrait JPEGs are left out of the table because they repeat the same row; their numbers are 41.455% unchanged and 13.245% moved by 32 or more.
The icon is the interesting row. It is 16,384 pixels wide enough for only 16 columns, so an 8 px block is a sixteenth of the image and the mean difference reaches 30.093 out of 255 — the highest in the folder. If you pixelate a favicon at 8 px you are not adding texture, you are replacing the icon.
On the 400 x 300 six-frame GIF the changed share climbs from 6.4% at 16 px to 13.653% at 32 px, then 27.307% at 64 px, then falls to 16.667% at 100 px. That last drop is not a rounding error. At 100 px the frame is 4 columns by 3 rows, and each column is a wide vertical slice whose average happens to land close to the original colour of many of its pixels, so the picture collapses into broad bands and a large share of pixels ends up within a level or two of where they started.
The 128 px icon does the opposite: 64 px gives 100% changed and 100 px also 100%, because the whole frame becomes one block. A giant block turns the image into a single colour, and a single colour has nothing left to differ from: the 100 px result on the icon holds 4 distinct colours, the 64 px result 4, the 32 px result 16, and a whole-frame block exactly 1. Block sizes past a sixth of the short edge stop being pixelation and become a colour average.
| File | 16 px | 32 px | 64 px | 100 px | Colours left at 32 px |
|---|---|---|---|---|---|
| animation.gif | 6.4% | 13.653% | 27.307% | 16.667% | 10 |
| small_icon.png | 74.933% | 100% | 100% | 100% | 16 |
| photo_square.png | 81.045% | 84.763% | 88.048% | 92.545% | 6,441 |
| photo_landscape.jpg | 62.142% | 63.954% | 66.197% | 69.426% | 6,503 |
Changed shares are of each file's own pixels. Colours left is the number of distinct RGB triples in the 32 px output, which is at most the cell count for that file.
Pixelation usually gets described as a way to shrink a picture. On this batch it does the opposite until the block is large. 2 px wrote 21,083,992 bytes of PNG from 20,934,926 bytes of input, 1.0071 times; 4 px wrote 6,652,709, 8 px 2,135,740, 16 px 768,858, 32 px 384,939 and 100 px 252,258. That ramp is the point: a flat colour repeated over a few pixels is exactly the pattern a lossless encoder cannot compress, because every block boundary is a new run.
| File | Input bytes | 2 px | 4 px | 8 px | 32 px | 100 px |
|---|---|---|---|---|---|---|
| photo_landscape.jpg | 2,403,704 | 4,428,874 | 1,377,378 | 433,960 | 74,260 | 47,241 |
| photo_square.png | 10,636,840 | 4,231,202 | 1,302,201 | 404,988 | 63,476 | 37,811 |
| photo_portrait.jpg | 2,443,475 | 4,362,439 | 1,347,708 | 421,353 | 72,265 | 46,552 |
| gray_8bit.jpg | 2,068,147 | 2,005,482 | 745,276 | 276,313 | 63,837 | 45,993 |
| screenshot.webp | 186,788 | 535,202 | 170,397 | 55,674 | 9,983 | 6,612 |
| small_icon.png | 22,214 | 8,349 | 2,755 | 1,136 | 463 | 390 |
All outputs were written as 8-bit RGB or RGBA PNG with no optimisation pass. Totals across the eleven readable files: 21,083,992 bytes at 2 px, 6,652,709 at 4 px, 2,135,740 at 8 px, 768,858 at 16 px, 384,939 at 32 px and 252,258 at 100 px, against 20,934,926 bytes of input. The portrait row is counted once in the totals.
The icon breaks the pattern and it is worth seeing why: at 2 px its output is smaller than its source, 8,349 bytes against 22,214, because the source already had a busy anti-aliased edge that the blocks remove. A file that is already large and smooth will inflate; a file that is already small and noisy will shrink. The size change tells you what kind of picture you started with, not whether the pixelation worked.
Pixelation writes an image, and an image is a container for more than its pixels. Four things survive or do not, and the batch makes each of them visible.
| File | Before | After | Note |
|---|---|---|---|
| logo_alpha.png | RGBA, 1,200 x 800 | RGBA, same alpha | alpha bytes identical at 8 px; colour under transparency averaged |
| animation.gif | 6 frames, indexed, 12-colour palette | 1 frame | a still-image path keeps the first frame only |
| gray_16bit.png | 16-bit, 65,536 levels | 8-bit | 0.954% of pixels moved by 32 levels or more |
| exif_orient6.jpg | orientation tag 6, stored 2000 x 1500 | no orientation tag | pixels are what they are; the tag that tells viewers to rotate is gone |
The transparency row is the one that bites in production. Alpha is copied through untouched, so a cut-out keeps its shape, but the colour of transparent pixels is averaged along with everything else. Where a transparent pixel shares a block with a visible one, its stored colour contributes to the block's average, and because the block is expanded over both, the fringe picks up whatever the invisible pixels were carrying. A cut-out saved on white and the same cut-out saved on black will pixelate to two different edge tones.
The orientation row is quieter and worse. A JPEG with tag 6 is stored sideways and rotated by the viewer; strip the tag without rotating the pixels and the file looks upright in your editor and lying on its side in the next tool. The pixels on this file did not move during pixelation, and neither did the instruction to rotate them: after saving through a path that does not carry EXIF, the tag reads empty.
Two passes over the same eleven files at 8 px produced identical bytes: SHA-256 3195b5ccac4482a5ce1ff10c9a75977f12413106b3cfcf5673c66acd5ea8019b for the top-left grid and a4d02844466f01e0a798405aa003ef5689cde3b4b2d07eed93093641ed0eb149 for the half-block-shifted grid, each hash built from the files in a fixed order. Same input, same grid, same output, every time.
Wall clock for the whole folder was 8.12 seconds at 8 px and 7.29 seconds at 16 px in the first pass, which says more about disk reads of 20.9 MB than about the arithmetic. Treat the timing as scale, not as a benchmark, and note that the 4000 x 3000 file alone took 1,007 ms at 8 px, so a folder of several hundred photos is a coffee break in a browser tab, not a blink.
What the number cannot give you is a guarantee. The block size says how wide the squares are; it does not say where the grid starts, whether the averages round or floor, whether the padding at edges mirrors or repeats the last row, or whether the tool dithers the result. Two tools that both say 8 px can differ on 10.652% of a landscape's pixels by 32 levels or more, and neither is wrong. Look at the output before you send it.
See all measured guidesYes, one block size can go across a whole folder, but the size is global and the files are not. At 8 px the batch produced 984,881 cells from 63,016,384 pixels, and the same 8 px changed 76.425% of a square PNG against 1.333% of a 16-bit grayscale scan. Sort the folder by pixel dimensions before you pick the number, because a 128 px icon and a 4000 px photo cannot share one sensible block.
No, it does the opposite of blur. Every block is filled with one flat colour, so edges become stairs, not gradients. On a 128 x 128 icon at 8 px the mean absolute error was 30.093 out of 255, against 0.726 on a smooth 16-bit grayscale scan, because the icon is mostly edges. A blur softens a boundary; pixelation moves it to the nearest grid line.
Same operation, two spellings, and both produce a single flat colour per block. What is not the same is the result at different sizes. Between 8 px and 32 px the visible share went from 13.296% to 21.426% of the batch while the cell count fell from 984,881 to 61,818, so the word you type does not matter and the number you type does.
It is the side length in pixels of each square that gets replaced by one colour. At 4 px every cell covers 16 pixels, so 3,938,524 cells were needed for 63,016,384 pixels. At 32 px each cell covers 1,024 pixels and 61,818 cells covered the same batch. Doubling the number halves the columns and the rows, which is four times fewer cells.
Size the block against the thing you are hiding, not against the whole picture. At 8 px on a screenshot of 1600 x 900, 16.699% of pixels moved by 32 levels or more, meaning most blocks barely differed from the original. A block that is smaller than the stroke width of a letter leaves the letter legible. Compare the output at 100% zoom before you send it, because proportional shrinking restores readable averages.
Because most pixels already sit inside a block that is nearly one colour. At 8 px, 41.847% of the batch was byte-identical before and after, and 330,182 of the 984,881 blocks came from a region that was already one uniform colour, 33.525%. On a tight palette like a six-frame GIF, 96.693% of pixels did not move at all, because a 400 x 300 frame only holds 50 columns of 8 px.
Yes, a lot, and no tool tells you where its grid starts. Shifting the 8 px grid by half a block on a 4000 x 3000 landscape rewrote 7,171,856 pixels, 59.766% of the frame, with 10.652% of pixels differing by 32 levels or more. Two tools running the same 8 px on the same file can therefore hand back different pictures, and both are correct.
The alpha channel is untouched and the colour channels are averaged with the image edge as padding. On the transparent logo the alpha bytes were identical before and after at 8 px, while 3.353% of colour pixels changed. Where transparent pixels sit inside a block, their stored colour is averaged into the visible one, so a cut-out saved on white and the same cut-out saved on black will pixelate to different edges.
Because it is smooth before you touch it, and it is squashed to 8 bits first. The file carried 65,536 sample values from 0 to 65,535, and after conversion to 8-bit only 256 were left; at 8 px just 1.333% of its pixels moved by even one level, with a mean absolute error of 0.726 out of 255. Neighbouring samples differ by a handful of levels, so the block average lands almost on top of every pixel it replaces.
At small block sizes it is bigger. On a 4000 x 3000 landscape JPEG the 4 px output was 1,377,378 bytes against 2,403,704 bytes of source, 0.573 times, but the 2 px output was 4,428,874 bytes, 1.8425 times the source. That pixelated look is loads of tiny flat colours, which is the worst case for a lossless encoder, so save as JPEG if size matters and as PNG only for cut-outs.