How to convert a PNG or JPG to DXF
- Drop a PNG or JPG on the box above, or click Open an image. WebP, BMP and GIF images work too. The image is read in this browser tab and never uploaded.
- Check the preview. Each traced outline is drawn in black, and the inside of each shape is shaded.
- Move Threshold until the outlines follow the edges. Move Detail down until specks drop out, and up if small features disappear.
- Type the Width or the Height of the image in millimetres or inches. The other side follows the proportions of the image.
- Click Download DXF.
To try the steps first, click Try a sample: a gear on an image 100 mm square.
How the tracing works
The converter reads the image as grey levels and splits them at the threshold, so pixels darker than the threshold are inside a shape. The automatic threshold starts from Otsu's method, which picks the grey level that best separates the dark pixels from the light ones. The converter then moves the threshold to the midpoint between the average grey levels of the two groups, which puts an anti-aliased edge where a pixel is half covered.
The outlines come from marching squares, which finds where the grey level crosses the threshold between neighbouring pixels by linear interpolation. An edge therefore lands between pixels instead of following the staircase of pixel corners. The converter then drops specks smaller than the Detail setting allows, and removes points that sit within a fraction of a pixel of a straight line, with the Ramer-Douglas-Peucker algorithm.
On the sample gear, drawn at 10 pixels per millimetre, the traced outline stays within 0.06 mm of the exact gear, and the 12 mm holes trace to within 0.04 mm of their diameter. A JPG copy of the same gear, saved at quality 60, traces to the same figures.
Getting a clean trace
- Start with the most pixels you have. The outlines follow the image to about a pixel, and the results show the size of one pixel. The converter traces at up to 2,000 pixels along the longer side, and scales a larger image down to that.
- Prefer PNG. PNG stores an image without loss, while JPEG compression is lossy. If a JPG traces with ragged edges, lower the detail a step.
- Light shapes on a dark background trace without a setting: when the edge of the image is dark, the converter traces the light areas. To switch by hand, tick Trace the light areas instead of the dark ones.
- A transparent background traces by opacity, so every solid pixel belongs to a shape, whatever the colour. Choose Dark areas to trace by darkness instead.
- Size. When the image records a resolution of 100 dpi or more, such as a 300 dpi scan, the converter starts at that true size. Otherwise the image starts 100 mm wide.
What a traced DXF cannot give you
Tracing finds the edges of shapes in a picture. The tracer cannot know what the shapes are meant to be.
- A drawn line becomes a thin shape. A line 1 mm wide comes out as a closed outline around the line, with an edge on each side. A cutter that follows the outline cuts both edges. For a single cut path, redraw the line in CAD.
- Curves become short straight segments. Holes and arcs are not rebuilt as true circles and arcs, so CAM software sees a many-sided polygon.
- The size comes from you. A picture has no units, so measure one feature that you know and set the width to match.
- Photos trace poorly. Shading, texture and shadows become hundreds of small shapes. The converter works best on drawings, logos and silhouettes with clear edges.
For a part cut to a tolerance, use the traced DXF as a reference and redraw the critical features in CAD. When the shape exists as vector art, the SVG to DXF and PDF to DXF converters keep the exact geometry.
Quote the parts in the sketches and scans customers send
Tell Derik how requests for quote reach your estimators and what they price from. He will tell you what a four-week build would cover.
Start a conversationFrom a traced outline to a quote
A request for quote can arrive as a photo or a scan instead of a CAD file. Once the outline is a DXF, the DXF viewer measures the cut length, the pierces and the weight, which are the inputs to a cutting price. The Fabricator's guide to estimating gives cutting time as the cut length over the cutting speed, plus the pierces times the pierce time.
ThriveAI builds quoting systems that read each request with the drawings attached, measure the parts and draft the quote from the shop's own rates, for an estimator to approve. See AI quoting software for how the build works.