Open DWG file
EnglishEN
Home › Convert DWG, DXF and DWF › JPG to DXF: trace a picture into vector lines

JPG to DXF: trace a picture into vector lines

Converting JPG to DXF means tracing: software has to find edges in the pixels and draw lines along them, because a JPG holds no geometry at all. This site does not trace images; it opens the finished DXF so you can check it. Below is the workflow that gives clean results for laser cutting, CNC, and CAD redraws.

What a JPG to DXF converter actually does

A JPG is a grid of colored dots. A DXF is a list of lines, arcs, polylines, and text with coordinates. To go from one to the other, a tracer looks for places where brightness changes sharply and fits curves along them. The result depends far more on the picture than on the tool: a black logo on a white background traces almost perfectly, a phone photo of a drawing on a desk traces into noise.

There are two tracing modes, and picking the wrong one is the usual reason a result looks wrong. Outline tracing draws the border of every dark shape, so a 1 mm line becomes two parallel curves. That suits signs, stencils, and anything a laser cuts out. Centerline tracing draws one line down the middle of each stroke, which is what you want from a sketch or a scanned plan you intend to edit in CAD.

Check the file in the viewerDrop a DWG or DXF here to open it. Nothing is uploaded.DWG R14–2018+, DXF ASCII or binary, up to 60 MB. Private: the file stays in this browser tab.

Prepare the image before tracing

  1. Crop to the part you need. Every stray mark at the edge becomes a stray polyline.
  2. Straighten it. A photo taken at an angle gives a skewed drawing; correct the perspective in GIMP (Tools > Transform > Perspective) or any photo editor first.
  3. Convert to black and white with a threshold, not plain grayscale. You want pure black lines on pure white paper.
  4. Remove speckles and JPG artifacts with a small despeckle or median filter. JPG compression leaves faint blocks around edges that tracers love to outline.
  5. Work at a decent size: at least 1500 pixels on the long side. Upscaling a tiny image does not add detail, but tracing a tiny image throws detail away.

Convert JPG to DXF with Inkscape

  1. Open the JPG in Inkscape (File > Open) and choose to embed the image.
  2. Select it and open Path > Trace Bitmap. Pick "Brightness cutoff" for outlines or "Centerline tracing" for single strokes. Press Update to preview.
  3. Raise "Speckles" to drop tiny islands, and raise "Smooth corners" if curves come out jagged. Click Apply.
  4. Drag the traced path off the photo and delete the original image, so only vector paths remain.
  5. Set the size you need with the W and H fields in the toolbar, in millimeters or inches.
  6. File > Save As and choose "Desktop Cutting Plotter (AutoCAD DXF R14)". Tick the LWPOLYLINE option so curves export as polylines.

The command-line tool Potrace does the same job in one step (potrace -b dxf image.bmp) after you save the picture as BMP. It is handy for batches and gives very smooth curves, but it only does outline tracing.

Online tracers and dedicated software

Web tracing services take a JPG and return a DXF in a few seconds. They are fine for a logo or a sticker. The image is uploaded to their server, so skip them for anything confidential, such as a client's site plan or a part drawing under NDA.

Paid raster-to-vector programs such as Scan2CAD and WinTopo add what matters for technical drawings. Their centerline tracing recognizes straight lines and arcs instead of wobbly curves, and they add text recognition and tools for joining broken segments. They pay off when you have a stack of old paper plans. For a single part outline, Inkscape is enough.

If you need DWG rather than DXF, convert the DXF afterwards; JPG to DWG covers that chain and the extra step it adds.

Check the DXF before cutting or editing

A traced file can look right at a glance and still be a mess underneath: thousands of tiny segments, duplicate outlines, or a size off by a factor of 25.4 because the tracer assumed inches. Drop the DXF on dwgviewer.app and look at three things.

  • Entity count in the status bar. A simple bracket outline should be tens of entities, not thousands. A huge number means the tracer split curves into short lines; raise smoothing and trace again.
  • Size. Use the measure tool across a dimension you know. If 100 mm reads as 3.94, the file is in inches; rescale before sending it to the machine.
  • Stray shapes. Zoom into corners and edges for speckles that became tiny closed loops. A laser will happily cut each one.

The file is read inside your browser tab and is never uploaded. For more on what is inside a DXF and which version to pick, see what is a DXF file and DXF versions.

Frequently asked questions

How do I convert a JPG to DXF?

Trace it. In Inkscape use Path > Trace Bitmap, delete the original picture, set the size, then save as AutoCAD DXF R14. Potrace and online tracers do the same in one step.

Why does my traced DXF have double lines?

Outline tracing draws both edges of every stroke. For drawings and sketches switch to centerline tracing, which draws one line down the middle.

Can a photo of a drawing be converted to DXF?

Yes, if you straighten the perspective and threshold the image to black and white first. Expect to redraw text and dimensions; tracers turn them into shapes.

What is the best image resolution for JPG to DXF?

At least 1500 pixels on the long side, and 300 dpi for scanned paper. Higher resolution helps until JPG artifacts start showing up as noise.

Is the DXF from a JPG to scale?

No. A picture has no units, so set the real width in Inkscape before export, or scale by a known dimension in your CAD program afterwards.

Can dwgviewer.app convert JPG to DXF?

No. It opens DWG and DXF files and does not trace images. Use it to check the traced DXF: size, entity count, and stray shapes.