How Photo Laser Engraving G-Code Works
A diode laser can only burn or not burn each spot, so a photo has to be turned into a pattern of dots first. The picture is resampled so that one pixel equals one line interval, the grey tones are turned into dots (dithering) or into power levels, and each pixel row becomes one back-and-forth pass of the laser head.
This page does the raster engraving job only. To cut shapes out, trace the outline to vectors with the Image to DXF Converter; to cut text or serial numbers with a spindle and engraving cutter, use the G-Code Engraving Generator. For carved relief in wood with a V-bit, see the planned image to V-carve G-code tool, and for 3D printed light-through photos the image to lithophane generator.
The Method
Laser Mode ($32=1), M3 and M4
GRBL 1.1 only behaves as a laser controller with laser mode on. Send $32=1 once (it is stored). With laser mode on, GRBL switches the beam off during G0 rapids, keeps moving without stopping when only the S value changes, and allows M4 dynamic power. With laser mode off, the machine pauses at every power change, which leaves burnt dots, and the beam can stay on during rapids. $30 is the S value for full power (1000 on most diode lasers, 255 on some); set the Max S value box to match it.
M4 scales the power with the actual speed, so the start and end of each line (where the head speeds up and slows down) are not over-burned. M3 holds the same power all the time. M4 is the normal choice for engraving; overscan still helps with either.
Worked Example
- Resolution: 25.4 ÷ 0.1 = 254 DPI. Dots: 100 ÷ 0.1 = 1000 across and 80 ÷ 0.1 = 800 down, so 800 000 dots and 800 lines.
- Each line (if the picture fills the full width): 100 mm + 2 × 5 mm overscan = 110 mm.
- Feed moves: 800 × 110 = 88 000 mm. Time: 88 000 ÷ 3000 = 29.3 minutes.
- Travel: bidirectional lines step up 0.1 mm each, about 80 mm of rapids in all, a second or so at 6000 mm/min. Lines that are blank are skipped, so a photo on a white background is quicker.
- Power: with $30 = 1000 and max power 80 %, every dithered dot burns at S800.
Line Interval and Spot Size
Set the line interval close to your laser's spot size. A typical diode laser spot is about 0.08 to 0.15 mm (check your laser's specification and focus it well), so 0.1 mm (254 DPI) is a good start. Much finer lines overlap and the picture goes dark and blotchy; much coarser lines leave stripes. Rule of thumb: on soft woods that char easily, a slightly coarser interval (0.12 to 0.15 mm) or a brighter image often looks cleaner.
Which Dither for Which Material
| Material | Mode to try first | Notes (rules of thumb) |
|---|---|---|
| Light wood, birch ply, MDF | Jarvis or Stucki | Wood darkens as heat spreads, so raise brightness or lower max power. Grayscale can work on even, light woods. |
| Slate | Threshold or Floyd–Steinberg, inverted | The laser turns slate lighter, so invert the image. Low power is usually enough. |
| Painted ceramic tile | Floyd–Steinberg or Atkinson | Results depend on the paint and method; test whether you need to invert. |
| Black anodised aluminium | Floyd–Steinberg or Atkinson, inverted | The laser removes dye and leaves a lighter mark. Blue diode lasers mark dark anodising far better than clear or bare aluminium. |
| Card, leather (real) | Stucki or Floyd–Steinberg | Low power and higher speed; these mark very easily. |
| Logos, line art, text | Threshold | Clean edges with no dot noise. |
Practical Tips
- Prepare the image first. Crop tight to the subject, remove or whiten the background (white costs no time), raise contrast a little and add a touch of sharpening. Faces usually need brightening because wood burns darker than a screen shows.
- Run a material test. Engrave a small power and speed grid on an offcut of the same material before the real job. The laser engraving settings page helps you plan one.
- Check the file. Open the G-code in the G-code viewer to see the size and position, then frame the job before burning.
- Prefer importing an image? Download the processed PNG: it is one pixel per line interval and stores its DPI, so LightBurn sizes it correctly on import. Use LightBurn's Pass-Through image mode so it does not dither the dots again. In other software, type the size in mm to match.
- Unidirectional if lines look offset. If every other line is shifted sideways, the machine has backlash or belt stretch. Turn bidirectional off (slower) or tighten the belts.
Laser Safety
- Never laser PVC, vinyl or faux leather that may contain PVC. It gives off chlorine compounds that harm you and corrode the machine.
- Watch the job. Wood and card can catch fire; never leave a running laser, and keep an extinguisher close.
- Wear eye protection rated for your laser's wavelength (445 to 455 nm for most blue diode lasers). The orange lid or tinted glasses that came with a cheap laser may not be rated; check the optical density marking.
- Ventilate. Smoke from wood, MDF and leather is harmful; extract it outdoors.
Frequently Asked Questions
Spot sizes, material advice and starting power are typical values and rules of thumb, not data for your laser. The time estimate ignores acceleration. Always run a test on scrap, check the G-code before running it, and never leave a laser unattended.