DPI, Dithering & Raster Alignment – Guide
Technical Guide · Diode Laser · LaserBase

DPI, Dithering & Raster Alignment –
when the pixel grid doesn't line up with the machine's physical grid

Why isn't a higher DPI always a better DPI?

The basic question

In a laser system's rasterizing process, two independent decisions are made: what the resolution should be, and what the binary pixel pattern should look like.

The user enters a DPI value, the software runs the dithering algorithm against that grid, then hands the result off to the machine. Most systems, however, don't check whether the given resolution actually fits what the motor's stepping characteristics can physically achieve.

Simple example: at 318 DPI, the line interval is about 0.0799 mm. If, for a given mechanism, this doesn't come out to a whole number of motor steps, the requested raster position doesn't land exactly on the machine's physical grid. In that case, the motion snaps to the nearest achievable position.

A good raster isn't just an image question. The dither dot structure also needs to fit the machine's physical step grid.

The physical grid

The machine doesn't move to continuous positions, but to physical step increments determined by the motor, the belt drive, and microstepping. In GRBL this shows up as the $100 / $101 / $102 step/mm values.

line interval = 25.4 / DPI
step size = 1 / step/mm
steps per line = line interval / step size
good fit: steps per line = a whole number
Fitting example

At 80 step/mm, one physical step is 0.0125 mm.

254 DPI → 0.10 mm line interval

0.10 / 0.0125 = 8 step

A whole number: the raster's line positions land exactly on machine lines.

Non-ideal example

At 80 step/mm, one physical step is 0.0125 mm.

318 DPI → approx. 0.08 mm line interval

0.08 / 0.0125 = 6.4 step

Not a whole number: the raster's line positions fall between the machine's step positions.

Key concept — position quantization / snapping

Position quantization, more plainly called snapping, happens when the desired raster position doesn't land exactly on a physical position the machine can achieve.

The machine can't move to an arbitrary, continuous position. It can only position itself at grid points determined by the motor steps, microstepping, and the mechanical drive ratio.

If a raster line falls between two such physical positions, the system snaps the motion to the nearest achievable position. This isn't a random error, but a natural consequence of the stepping system.

The effect of snapping is most visible in fine tonal gradients: as a repeating pattern flaw, grainier transitions, or slight tonal distortion.

What happens with an unaligned raster?

If the two grids don't coincide, some of the dither dots end up between the line positions the machine can achieve. The controller and mechanics force these to the nearest reachable position. In practice, this causes position quantization, or in simpler terms, a snapping effect.

This is a system-level, repeating error. Not random noise. It shows up most in fine tonal gradients, because there the distribution of dither dots is especially sensitive to line-position accuracy.

Unaligned raster

The dither runs on an abstract pixel grid. The machine, however, can only move on a different, physical step grid.

Result: snapping, tonal distortion, repeating pattern flaws.

Aligned raster

The dither runs on the grid the machine can actually position on.

Result: more stable tonal gradients and better repeatability.

Interactive demonstration

The demo below shows the same phenomenon as the guide: the dither lines and the machine's physical line positions either coincide, or they don't. The input values can be changed.

Step size
Line interval
Steps / line
Aligned DPI
Deviation
Not aligned requested DPI
small deviation
medium deviation
large deviation
machine line
Aligned effective DPI
dither point = machine position
machine line
Matching the physical size
ideal line count = requested size / real pitch
snapped line count = round(ideal line count)
effective size = snapped line count × real pitch
Requested physical height
Real pitch
Ideal line count
Snapped line count
Effective physical height
Size error

Note: the canvas demo illustrates line-position alignment. The physical-size block shows LaserBase's second step: based on the aligned pitch, the full object size is also snapped to a whole number of lines.

Practical table

The table below shows how commonly used line-interval values fit different GT2 / motor configurations.

DPI Line interval 80 step/mm 100 step/mm 160 step/mm 200 step/mm

The object's physical size is also part of the raster

The raster isn't just about DPI. From LaserBase's perspective, three pieces of data together determine the final output: the requested DPI, the machine's step/mm value, and the object's physical size in millimeters.

Once the system has selected the mechanically stable pitch, it also has to check how many such lines the given physical height can be made up of. If the size doesn't land exactly on a whole line count, the end of the whole raster also needs to be snapped.

stable pitch = stable steps/line / step/mm
ideal line count = requested span / stable pitch
snapped line count = round(ideal line count)
effective span = snapped line count × stable pitch

Because of this, the effective DPI and the effective physical size need to be interpreted together. The goal isn't to automatically preserve the requested DPI, but to keep the entire raster physically stable throughout: the same pitch, whole steps, a whole line count, a reproducible output.

Concrete example — 1024×1024 px image, 250×250 mm object, 318 DPI

Given:

Source image: 1024 × 1024 pixels
Desired physical size: 250 × 250 mm
Requested quality: 318 DPI

First we calculate the real line interval for 318 DPI:

line interval = 25.4 / DPI
25.4 / 318 = 0.079874 mm

This means the distance between raster lines is about 0.0799 mm.

Mechanism Step/mm Steps/line Stable value Effective DPI Effective size
1.8° + GT2 20T 80 6.39 7 step 290.29 DPI 249.99 mm
1.8° + GT2 16T 100 7.99 8 step 317.5 DPI 250.00 mm
0.9° + GT2 20T 160 12.78 13 step 312.62 DPI 250.01 mm
0.9° + GT2 16T 200 15.97 16 step 317.5 DPI 250.00 mm

For the 100 and 200 step/mm systems, 318 DPI fits almost perfectly. For the 80 and 160 step/mm systems, however, snapping is needed, so the effective DPI differs from the requested value.

The source image's native size also matters:

1024 px / 318 DPI = 3.22 inch
3.22 × 25.4 = 81.9 mm

This means the image's native size at 318 DPI would only be about 82 mm. If the user requests a 250 mm engraving, the image gets scaled up.

The final raster isn't determined by the source image's original DPI, but by the mechanical raster pitch. The final output is determined by the parameters the mechanical system can physically achieve stably.

The LaserBase approach

LaserBase doesn't assume that the DPI value the user enters is necessarily physically ideal. The system first calculates, from the machine's stepping data, which line positions can be achieved cleanly, and fits the raster to that.

So the effective DPI isn't automatically the correct final value, but a result computed from the machine's mechanical characteristics. Dithering, then, doesn't run on an abstract pixel grid, but on the physical grid the machine can actually position on.

The same physical grid + the same dither + the same input = a more repeatable, more predictable output.

Dithering quality doesn't just depend on the algorithm.
It's just as important that the binary pixel pattern fit the machine's physical step grid.