Skip to content
CNC · Workflow · 2026

Image to G-code for CNC — the complete 2026 workflow

From a photograph or logo to a G-code program your router, laser or mill will actually cut cleanly. No magical one-click button, just the six steps that survive production.

Published April 16, 2026 · 10 min read
TL;DR — the six steps
  1. Clean the raster (crop, upscale, contrast).
  2. Vectorize with the preset matching the CNC operation.
  3. Export DXF (R12 or AC1015) with real-world width.
  4. Import into CAM, assign toolpaths per layer.
  5. Simulate, pick the right post-processor, write G-code.
  6. Dry-run on the machine before touching material.

Why this is a two-stage job (not one tool)

The phrase "image to G-code" hides two independent problems. Stage A turns pixels into vector geometry. Stage B turns vector geometry into machine motion. The tools that pretend to do both in one click (some cheap laser-engraver tools, most "AI G-code generators") do either stage badly because they can't ask what your machine is, what bit is in the spindle, or whether you want pocket vs. profile.

Separating the stages also lets you debug. Bad cut? Check the DXF in a viewer: if geometry is wrong, fix stage A. If geometry is right but the machine moved wrong, fix stage B.

Step 1 — Clean the source image

Every later step is only as good as your starting raster. Four checks:

  • Resolution. Aim for at least 1,000 px across the longest edge. Below that, vectorization guesses edges from pixel noise and you get jagged outlines.
  • Contrast. If the subject is a dark logo on a slightly darker background, the vectorizer won't find the edge. Raise contrast in any image editor (or use VectoSolve's built-in clean-source pass) before tracing.
  • Shading. Photographs have gradients. For outline-based CNC work (profile cut, v-carve) you want flat fills — apply a shading filter or threshold first.
  • Background. Remove it. White background + black subject = unambiguous edge detection.

Step 2 — Vectorize with the right preset

Which preset depends on what the CNC is doing:

CNC operationPresetWhat it outputs
Profile cut (router / laser through-cut)OutlineClosed paths, one per cut piece
V-carve (signmaking)CAD Reference / OutlineClosed regions with inside + outside boundaries
Pocket (recessed area)OutlineClosed region = material to remove
Engrave / score (surface line)Line / CenterlineSingle-pass paths, no fill
Laser photo engraveShading / rasterDithered bitmap (not vector) passed straight to LightBurn
3D relief (limited, router)Bitmap depth mapGrayscale PNG mapped to Z in VCarve / Aspire

Critical: paths must be closed for profile and pocket operations. Open paths produce unpredictable cuts — the CAM doesn't know which side of the line is "inside". Most consumer vectorizers produce open paths when they trace a thick outline in a raster, treating the stroke as two separate contours. VectoSolve's CAD-Reference preset merges them automatically, which is the single biggest reason the CAD-reference flow exists.

Step 3 — Export DXF with real-world scale

Three settings that matter at export:

  1. DXF version. R12 (AC1009) for legacy CAM, AutoCAD 2000 (AC1015) for modern CAM. See our DXF R12 vs AutoCAD 2000 decision guide.
  2. Real-world width. Type the actual intended dimension (e.g. 120 mm). The exporter writes $INSUNITS and scales the geometry so your CAM imports at 1:1.
  3. Layers. Put profile, pocket and engrave geometry on separate layers with meaningful names (PROFILE, POCKET, V-CARVE, SCORE). VCarve and Mastercam both auto-map layers to operation presets by name.

Step 4 — Assign toolpaths in CAM

Each CAM package has its own UI, but the decisions are the same:

  • Tool. Pick or define the bit. Diameter, number of flutes, cut length, max RPM. The CAM uses these to calculate feed and plunge rates.
  • Depth. Total cut depth and depth per pass. For MDF, aim for 40-60% of tool diameter per pass; for aluminum, 10-20%.
  • Feed rate & spindle RPM. Use the tool manufacturer's chart or a feeds-and-speeds calculator. Too slow burns the material; too fast breaks the bit.
  • Stepover / offset. For pockets, the horizontal overlap between passes (typically 40% of tool diameter). For profile cuts, the side of the line (inside / outside / on) matters because of the kerf.
  • Plunge strategy. Straight down for laser, ramp or helix for router bits that can't plunge vertically.
  • Order of operations. Usually engrave first (least disruptive), then pocket, then profile last. Tabs on profile cuts keep parts from moving.

Step 5 — Simulate and post-process

Before writing G-code, run the CAM's simulation. Look for:

  • Rapid moves dipping below safe Z — the bit travels at full speed and will gouge the work or break on clamps.
  • Toolpath going outside the stock boundary.
  • Start / end points touching the clamp locations.
  • Total estimated time — if 45 min is what you budgeted and the simulator says 6 hours, something is wrong (usually feed rate set in mm/s instead of mm/min).

Post-processor. This converts the CAM's internal representation into the G-code dialect your controller expects. Choose carefully:

ControllerPost-processor to pick
GRBL (Shapeoko, X-Carve, most hobby CNCs)GRBL / Shapeoko
Mach3 / Mach4Mach3 Mill (inch or mm variant)
LinuxCNCLinuxCNC (EMC2)
Masso G3Masso Router or Masso Mill
HaasHaas (NGC or classic)
FanucFanuc (machine-specific)
Ruida (laser)LightBurn writes .rd directly (no generic G-code step)

Picking the wrong post is the most common source of silent failures. A Mach3 post on a GRBL controller can produce syntactically-valid G-code that still homes the wrong axis or ignores spindle commands.

Step 6 — Dry-run before cutting

Even after simulation, always dry-run on the actual machine:

  • Air cut. Set Z zero 25 mm above material, run the whole program. Watch the spindle path. If anything looks wrong, abort with the feed-hold button.
  • Watch the travel limits. Machines with soft limits will E-stop if a rapid exceeds them. Machines without soft limits will crash the bit into the gantry at full speed.
  • Listen to the spindle. Chattering, squealing or the motor bogging down signals feeds-and-speeds error.
  • Check retract height. Confirm the tool lifts above clamps between passes.

Only after a clean air cut do you touch material. Then: shallow test cut (depth = 10% of target), check dimensions with calipers, then full program.

Common failures and fixes

CAM imports the DXF but no toolpaths can be assigned
Cause: Paths are open. CAM needs closed paths for profile and pocket ops.
Fix: Re-vectorize with the Outline or CAD Reference preset. VectoSolve closes paths automatically; most other vectorizers do not.
Cut runs at the wrong scale (25.4× too big or small)
Cause: $INSUNITS is missing from the DXF header. CAM fell back to its default unit.
Fix: Use the real-world-width field in the converter. Re-import. Or edit the DXF header to add $INSUNITS=4 for mm or 1 for inches.
Toolpath generation takes forever and fails halfway
Cause: Entity count explosion — typically 30k+ tiny line segments from a spline decomposition.
Fix: Re-export the DXF with path simplification enabled, or switch to AC1015 if your CAM supports it (splines stay as one entity).
Laser engraves only part of the design
Cause: LightBurn is set to 'Cut' mode but the design uses 'Fill' layers, or vice versa.
Fix: Check layer assignments in LightBurn. For raster / photo mode, the preset should be 'Image' layer, not 'Line'.
Bit breaks on first plunge
Cause: Vertical plunge on a non-center-cutting bit, or plunge rate too fast.
Fix: Switch to ramp or helix plunge in the toolpath settings. Check the tool spec; many end mills cannot plunge straight down.
Parts move during the cut
Cause: Missing tabs on profile operations, or clamping force overridden by cut forces.
Fix: Enable tabs (3-4 tabs per part, 3-4 mm wide, 1 mm thick). Revisit clamping strategy.

Which CAM and CNC controller pairs well with what

ScenarioCAMControllerBest DXF version
Sign shop (V-carve + profile)VCarve V10+GRBL / Mach3AC1015
Hobby maker (simple profiles)Carbide CreateGRBLAC1015
Job shop (mill / multi-axis)Mastercam 2025+Haas / FanucAC1015
Wire EDM (ESPRIT)ESPRIT 2020Agie Charmilles / Sodick / MitsubishiR12 (AC1009)
Laser cutter (photo + cut)LightBurnRuida / GRBL-LPCAC1015 (+ SVG)
DIY mill / router (desktop)Fusion 360GRBL / LinuxCNCAC1015 or newer

Where VectoSolve fits in the chain

VectoSolve covers stage A: raster → DXF. It does not generate G-code (that's your CAM's job, because G-code is machine- and material-specific). What it does:

  • Closes paths automatically so your CAM can assign profile / pocket toolpaths.
  • Writes $INSUNITS from the real-world-width field for 1:1 scale.
  • Exports R12 or AC1015 depending on the CAM target picked from the dropdown.
  • Runs a compatibility analyzer that flags entity-count overflow for ESPRIT, ArtCAM and other legacy CAM before you commit the export.
  • Supports layered DXF (PROFILE / POCKET / V-CARVE / SCORE) so VCarve and Mastercam auto-assign operations.

Start with a clean DXF

Skip the vectorize-and-debug cycle. VectoSolve produces closed-path, real-world-scaled DXF with layers your CAM can auto-map.

Customer artwork arriving as screenshots every week?

We also do the whole job as a service: send the customer's file, get a free quote, see the watermarked preview, then pay. From $9 a file, delivered in the format your machine reads, with no VectoSolve name in the files.

Done-For-You Service