Jarvis vs Stucki vs Sierra: Choosing an Error-Diffusion Kernel by Image Type
Jarvis and Stucki spread error to the same 12 neighbours, Sierra to 10 at a cheaper divisor. Here are the matrices, the cost, and a way to pick by image type.
01/ ARTICLE
subject: snow leopard · look: jarvis · threshold 0.50 · 2px · Image made with kott.io
Which is better for dithering: Jarvis, Stucki or Sierra?
No kernel of the three wins on every image. Jarvis-Judice-Ninke and Stucki spread each pixel's error to the same 12 neighbours over three rows, Sierra's three-line kernel spreads it to 10, and all three give calmer results than Floyd-Steinberg's 4 neighbours at a higher cost. Pick Stucki or Jarvis for smooth tones and fine detail, and Sierra when you want similar quality at a cheaper divisor.
Jarvis-Judice-Ninke dithering is an error-diffusion algorithm that spreads each pixel's quantization error to 12 neighbours over three rows, with weights that sum to 48. Below you'll find the weight matrices, what the numbers imply, and a way to choose by image type. The choosing advice is my judgement from the kernel properties; none of the sources I read ranks the kernels by image type, and I give no timings because I did not measure any.
What do the three kernels have in common?
All three quantize one pixel at a time, then push the difference between the old and new value onto pixels that haven't been processed yet: to the right in the same row and down into the next rows. Jarvis, Judice and Ninke of Bell Labs published theirs in 1976, nearly concurrently with Floyd-Steinberg, and described it as a larger kernel that minimizes average error.
The reason to use a larger kernel is artifacts. Wikipedia's error diffusion article notes that dispersing the error over a larger area, plus a serpentine scan, reduces them. The same article warns that error diffusion tends to enhance edges, at the expense of gray-level accuracy. If you want the background on the stringy "worm" patterns and the alternating scan direction, read worm artifacts and serpentine scanning.
I found no source that compares worm artifacts between Jarvis, Stucki and Sierra, so I don't claim that one removes them better than another.
How do Jarvis, Stucki and Sierra differ?
They differ in weights, divisor and footprint. The table lists each kernel with Floyd-Steinberg and Burkes for reference. Weights are written row by row; the current pixel is *, and rows 1 and 2 are centred under it (columns -2 to +2).
diagram · Stucki error-diffusion kernel; filled cell: the current pixel; hatched: pixels already done; bars: error shares 8/42, 4/42, 2/42, 4/42, 8/42, 4/42, 2/42, 1/42, 2/42, 4/42, 2/42, 1/42 · seed 42
| Kernel | Year, author | Neighbours | Divisor | Row 0 (right of *) | Row 1 | Row 2 |
|---|---|---|---|---|---|---|
| Floyd-Steinberg | 1975/76, Floyd and Steinberg | 4 | 16 | 7 | 3 5 1 (cols -1 to +1) | none |
| Jarvis-Judice-Ninke | 1976, Jarvis, Judice, Ninke | 12 | 48 | 7 5 | 3 5 7 5 3 | 1 3 5 3 1 |
| Stucki | 1981, P. Stucki | 12 | 42 | 8 4 | 2 4 8 4 2 | 1 2 4 2 1 |
| Sierra (three-line) | 1989, Frankie Sierra | 10 | 32 | 5 3 | 2 4 5 4 2 | 2 3 2 (cols -1 to +1) |
| Burkes | 1988, Daniel Burkes | 7 | 32 | 8 4 | 2 4 8 4 2 | none |
Sources: the DHALF.TXT reference for years, authors and matrices, cross-checked against the hitherdither weight tables. Floyd-Steinberg's year is 1975 in DHALF and 1976 in the Wikipedia citation; sources disagree, so I show both.
What do the weights tell you?
Stucki is Jarvis reworked in 1981 with the same footprint. The nearest pixel to the right gets 8/42 of the error (0.190) in Stucki and 7/48 (0.146) in Jarvis, so Stucki keeps more of the error close to where it was made and passes less of it far away. DHALF reports that Stucki "has been observed to give very clean, sharp output". Treat that as an observation by the author of that reference, not a measurement.
Sierra's three-line kernel drops the outer corners of the bottom row, so it touches 10 neighbours, and its divisor is 32. Its right and below weights are both 5/32 (0.156), which sits between Jarvis and Stucki on the nearest-neighbour share. Sierra later published a two-row version over 16 and a "Lite" version over 4 that DHALF says, according to Sierra, beats the original Floyd-Steinberg. kott ships the three-line version only.
Burkes is Stucki with the bottom row removed, which leaves 7 neighbours, a divisor of 32 and one fewer row of forward error to store.
What does each kernel cost?
Cost comes from the divisor and the number of rows you must keep. DHALF points out that division by 48 or 42 means real divide instructions, while 32 is a power of two and can be done with shifts. Both three-row kernels need two forward error arrays, and Jarvis talks to three times as many neighbours as Floyd-Steinberg. Those notes come from 1990s code on slow processors. On a GPU or a modern CPU the gap is small, and I did not time it.
How do I choose a kernel for my image?
Start with Stucki or Jarvis for a still photograph, and switch to Sierra only if you have a reason. The reasoning below comes from the weights above and is a starting point to test, not a rule.
- Smooth gradients such as skies, skin or fur falloff: use Jarvis or Stucki. The wide three-row spread distributes error over more pixels, which is the property Wikipedia ties to fewer artifacts.
- Fine detail and sharp edges: try Stucki first. Its heavier nearest-neighbour weights are consistent with the sharp, clean output DHALF describes. Remember that error diffusion enhances edges anyway, which helps text and line art and costs tonal accuracy on photographs.
- Many images or a live preview: Sierra three-line, Burkes, or Sierra Lite give you power-of-two divisors and fewer neighbours. Check the result by eye, because the saving is in compute, not quality.
- Animation: avoid all of them. The hitherdither source warns that error diffusion works nicely for static pictures but causes an avalanche of jittering artifacts in animation, since a small change in one pixel moves error through the rest of the frame.
Two things matter more than the kernel. First, dither in linear light, or your midtones will come out too bright: see dither in linear light. Second, for colour output, fix the palette first, as covered in choosing a palette before you dither.
What are the kott settings for each kernel?
In kott's error-diffusion effect, the kernel control offers FLOYD, ATKINSON, JARVIS, STUCKI, SIERRA (the three-line version) and BURKES, and the scan is serpentine. The defaults are threshold 0.5 and pixel size 1 px, and pixel size runs from 1 to 12 px.
To compare kernels fairly, load one photograph, set threshold 0.5 and pixel size 2, then change only the kernel between runs. Keep the same image, the same threshold and the same pixel size, or you are comparing settings instead of kernels. Zoom to 100% when you judge, because the differences between these three are small at fit-to-screen.
Which kernel should I start with?
Start with Stucki for photographs and Jarvis for the smoothest tones, and keep Sierra for the cases where cost or a power-of-two divisor matters. The kernels differ by small amounts at normal viewing size, so spend your effort on linear light and the palette first. Open the dither effect in kott studio and switch the kernel yourself on your own image.
Frequently Asked Questions
Is Stucki better than Jarvis?
They share a footprint of 12 neighbours over three rows and differ in weights and divisor (42 against 48). DHALF notes that Stucki was reworked from Jarvis in 1981 and gives very clean, sharp output. No source I found ranks one as better overall, so test both on your image.
Why is Sierra often cheaper than Jarvis or Stucki?
Sierra's three-line kernel uses a divisor of 32, a power of two, so shifts can replace divides, and it spreads to 10 neighbours instead of 12. The two-row version (divisor 16) and Sierra Lite (divisor 4) cut the cost further.
What is the difference between Burkes and Stucki?
Burkes, from 1988, is Stucki with the bottom row removed. It spreads to 7 neighbours, uses a divisor of 32, and needs one fewer row of forward error.
Does serpentine scanning work with all of these kernels?
Yes. DHALF states that serpentine scanning can be used with any of the error-diffusion filters it lists, and kott's error-diffusion effect scans in serpentine order.
Images in this article were made with kott.io.
02/ OUT
Every setting described above is a real control. Open your own image and sweep it.
All journal entries