Dither · line interval · 1-bit PNG · GRBL raster

Laser Engraving Image Prep

Turn a picture into the black-and-white dots a diode laser can burn, check it at true size, and export a PNG or G-code.

Picture

PNG, JPG, WEBP, GIF or BMP

Drop a picture here or click to choose

Up to 25.00 MB; transparent areas are treated as white.

Size and material

Rough values for a small diode laser. Machines, lenses and materials differ widely, so run a test grid first.

254 dpi. Roughly the width of the laser's burn spot; smaller overlaps lines, larger leaves gaps.

Tone and dither

Spreads each pixel's error over 4 neighbours. Smooth tones, fine grain.

Above 1 lightens midtones, below 1 darkens them.

G-code

Burn power S650.

Runs this far outside the image at each row end so the head is at speed on the image.

Result

Open a picture to see the dithered result.

Laser Engraving Image Prep

Operator: Abdulla Al Fahad. How tools are built and checked

A diode laser has two states, burning and not burning, so a photograph has to become a field of black dots before it can be engraved.

How those dots are placed decides whether a face looks like a face or like wire mesh.

This page does that conversion on a grid that matches the laser: you choose the engraving width and the spacing between scan lines, the picture is resampled to exactly that many pixels, and one of six methods turns it into burn and no-burn pixels.

Key features

  • Floyd-Steinberg, Atkinson, Jarvis-Judice-Ninke and Stucki error diffusion, an 8×8 ordered (Bayer) pattern, and a plain threshold
  • Brightness, contrast, gamma, black and white cut-off and invert, applied before dithering
  • Width in millimetres and line interval in millimetres, with the DPI worked out (0.1 mm is 254 dpi)
  • Starting points for plywood, leather, cardboard, dark acrylic, slate and anodised aluminium, which you can edit
  • A true-size preview at 96 CSS pixels per inch, pixel for pixel
  • A 1-bit PNG with the pHYs chunk set to the DPI, and GRBL raster G-code with overscan, bidirectional rows and power scaled by speed

How the dots and the G-code are made

Error diffusion walks through the picture row by row. At each pixel it picks black or white by the cut-off, measures how far that choice was from the true brightness, and passes the difference to neighbouring pixels that have not been decided yet. Floyd-Steinberg shares the error over four neighbours in the ratios 7, 3, 5 and 1 sixteenths. Atkinson shares only three quarters of it, in six equal eighths, so very light and very dark areas clip cleanly. Jarvis and Stucki spread it over twelve neighbours, which gives smoother, less patterned tones at more cost.

The ordered method compares each pixel with a fixed 8×8 threshold map. It has no memory, so it is the fastest and the most regular, which can look cleaner on materials that burn unevenly. A mid-grey burns about half the pixels in every method, so the methods differ in where the dots fall, not in how many.

The PNG is true 1-bit grayscale (bit depth 1, colour type 0) compressed with zlib, with a pHYs chunk of the DPI converted to pixels per metre, so 254 dpi is stored as 10,000. A laser program that reads the resolution scales the file to the right physical size without asking.

The G-code writes one row of dots at a time along X, with Y stepping by the line interval from the bottom of the image upwards so the picture is upright. White stretches are skipped with S0 moves and black runs are burnt with a single G1 move at power S, so a row of 400 alternating dots is 400 short moves, not 800 pixel moves.

How it works

The picture is drawn onto a canvas of exactly the target pixels, over white so transparency reads as no burn, and converted to luminance. The tone curve is applied through a 256-entry lookup table, then the dither runs in a worker that can be cancelled by changing any setting.

Power scaling is simple arithmetic. With a reference of S650 at 3,000 mm/min, running at 6,000 mm/min asks for S1,300; because the maximum is S1,000, the page caps it and says that the energy per millimetre is now lower than the reference. The energy a spot receives is roughly proportional to S divided by feed, which is why the two move together.

Overscan adds a run outside the image at each end of a row, because a head that starts moving inside the image burns the first millimetre at a lower speed and so darker. The first rapid goes to that outside point, which is why the header asks you to leave room around the work origin.

Common use cases

  • A portrait for a 100 mm wooden coaster at 0.1 mm interval is 1,000 × 1,000 pixels. A gamma of 1.2 lightens the midtones, which helps keep the cheeks from burning solid on birch plywood, and Stucki keeps the edges of the face crisp.
  • A logo for anodised aluminium marks lighter than the metal, so the Invert option burns the logo shape and leaves the background. Plain threshold keeps its edges sharp, where dithering would turn them to dust.

How to use this tool

  1. Open the picture and set the engraving width and the material starting point.
  2. Choose a dither method and tune brightness, contrast and gamma until the true-size preview looks right.
  3. Set feed, maximum S and whether power follows speed, and read the burn power line.
  4. Download the 1-bit PNG for your laser software, or the G-code for GRBL.
  5. Compare the true-size preview with a test burn on your material and adjust gamma if the shadows fill in.

Example

A vertical white-to-black ramp as an 80 × 60 mm picture, plywood starting point (0.1 mm interval), Floyd-Steinberg, 3,000 mm/min, S650 reference

Width 80 mm → 800 × 600 pixels at 254 dpi; overscan 2 mm; burn in both directions; laser command M4

Numbers shown

About 50% of the pixels burnt (49.96% with Floyd-Steinberg)
After Download G-code the page reports 240,401 lines, 119,597 burn runs and about 16.5 minutes of scanning at 3,000 mm/min
The PNG downloads as ramp-floyd-254dpi.png, a 1-bit file that carries 254 dpi
At 6,000 mm/min, S would be 1,300 and is capped at S1,000, with about 8.3 minutes of scanning

Common pitfalls

The material starting points are rough numbers for a small diode laser. Wood, lens, focus and even humidity change the result, so treat them as a first guess.

A line interval below the spot size does not add detail; it only adds burn time and darkness.

G-code assumes GRBL laser mode ($32=1) and a work origin at the bottom-left of the image. Other controllers read S and M4 differently.

  • Use the same line interval as the real spot size of your laser. A 0.1 mm interval with a 0.2 mm spot overlaps each line twice and burns darker than the preview suggests.
  • Try Atkinson on faces and line art, Floyd-Steinberg on landscapes, and ordered when a material chars unevenly; the differences show best at true size.

Common errors and how to fix them

"At 0.03 mm the image would be … pixels. The limit is 9,000 per side"
Use a larger line interval or a smaller engraving width; a 200 mm picture at 0.03 mm would need 6,667 pixels across, and every row adds burn time.
"The G-code would pass 2,500,000 lines"
Raise the line interval, reduce the size, or use the PNG in your laser software instead.
"Feed rate must be between 10 and 30000"
Enter the speed in millimetres per minute, as GRBL expects.
The preview is almost all black or all white
Check the Invert switch and the cut-off: with Invert on, a picture on a dark background burns the background and leaves the subject.

Best practices

  • For a quick power test, burn a 10-step grey ramp at several S and feed values on scrap of the same material and note which step first looks right.

Frequently asked questions

Why does the burn come out darker than the preview?

The preview draws each dot as a square exactly one line interval wide, while the laser burns a round spot. If the spot is wider than the interval, neighbouring lines and dots overlap and heat builds up in the wood, so midtones fill in. Burn a few test lines at 0.05, 0.1 and 0.15 mm intervals, pick the narrowest interval where the lines stay distinct, and raise gamma above 1 to lighten what is left.

Why are the download buttons locked after I change a setting?

The dots are rebuilt a moment after each change, and a file made from the old grid would carry the wrong size and DPI. The buttons unlock when the preview matches the settings on screen, and they stay hidden while the size or line interval would make the image exceed the pixel limit.

Why does 1-bit PNG matter?

Laser software often resamples greyscale or colour images, which shifts the dots. A true 1-bit file has only burn and no-burn pixels and carries its DPI, so the software has nothing to interpolate.