Skip to content

PNG to DXF: turn a picture into a vector file in millimetres

Drop a photo or a logo and get closed contours in SVG and DXF R12, sized in millimetres. Everything runs in the browser, and the contour is made of straight segments, the same ones a machine follows.

Part of Pro, 15 EUR a month.

What it means to turn an image into a vector file

PNG to DXF means turning pixels into lines. This online tool from EduFacturing, part of Pro, converts a raster picture (PNG, JPG, WEBP, GIF or BMP) into vector contours and writes them as SVG and DXF R12 in millimetres. A laser, a plotter and a router follow lines, not pixels, so that is the file they need.

The boundary is traced along the edges between pixels, not through their centres, so a rectangle comes out as four points. Contours are straight segments with no Bézier curves.

Everything happens in the browser. A picture longer than 900 px on its long side is scaled down to 900 px before tracing, and the screen says so.

PNG to DXF: the EduFacturing logo (1563×1563 px, downscaled to 900×900) as a raster on the left and as a black vector of 45 contours and 828 points on the right, with an Otsu threshold of 184, a simplification slider and the SVG (in millimetres) and DXF R12 buttons
PNG to DXF: the EduFacturing logo (1563×1563 px, downscaled to 900×900) as a raster on the left and as a black vector of 45 contours and 828 points on the right, with an Otsu threshold of 184, a simplification slider and the SVG (in millimetres) and DXF R12 buttons

Image to DXF and SVG: what the tool does

Turns a picture into a black-and-white or colour vector

“Black and white” builds a mask from a threshold: the threshold comes from Otsu’s method or is set from 1 to 254, and “Invert light and dark” swaps which side is ink. “Colour” reduces the picture to 2 to 12 colours and makes a separate layer for each.

Cleans and simplifies the contour

Simplification from 0 to 6 px by Ramer–Douglas–Peucker (1.2 by default), rounding of soft corners, and removal of spots below a chosen number of px² (12 by default). Two spots touching only diagonally stay two shapes.

Sets the size in millimetres

Output width from 10 to 600 mm; the height follows the proportion. Shapes are filled or outline only. The screen shows the contours, points, layers and threshold.

Downloads SVG and DXF R12

The SVG is in millimetres, with a layer group for each colour. The DXF is R12 in millimetres with ANSI_1251 and a closed polyline for each contour. Layer names match.

When you need a DXF or SVG from a picture, logo or sketch

Before a laser, a plotter or a router can cut a picture, it has to be turned from pixels into lines.

  • A logo as a vector file to engrave or cut

    The EduFacturing logo (1563×1563 px, scaled down to 900×900) comes out as one layer of 45 contours and 828 points at threshold 184 and the default settings (simplification 1.2 px, spots under 12 px², width 100 mm).

  • Multicolour cutting

    In colour mode every colour is a separate layer in the SVG and in the DXF: “ready for multi-colour cutting or multi-colour printing”, as the screen puts it.

  • A sketch or scanned drawing to DXF

    A photo of a sketch on paper becomes closed contours. “Invert light and dark” helps if the drawing is light on dark.

  • Preparing for 2D CAM

    Per the screen, both files go into the 2D CAM bridge, where kerf compensation, tabs, cut ordering and G-code are added. The bridge loads a file by hand.

How an image becomes a vector file

The picture goes through four steps: grey and threshold or colours, boundary tracing, simplification and output in millimetres.

  1. Grey and threshold

    Brightness follows Rec. 601, and transparent pixels count as white. The Otsu threshold separates dark from light most strongly.

  2. Colours

    Colour mode splits colour boxes at the middle of their range. Transparent pixels stay out of every layer. The layer with more pixels sits at the bottom.

  3. Boundary

    Touching edges of filled cells are joined into closed contours. Where cells touch diagonally, the two spots stay two shapes.

  4. Simplify and output

    Stair-steps drop out by Ramer–Douglas–Peucker, soft corners are rounded and coordinates are scaled to millimetres. Turns of 60° or more stay sharp.

The formulas and rules in the tool
Applies toFormulaMeaning
Otsu thresholdσ² = w₁ · w₂ · (μ₁ − μ₂)²the threshold with the largest σ² wins; w are the pixel counts of the two groups and μ their mean brightness
Simplificationmax d ≤ tolerance → only the chord staysd is the distance of the arc’s points from the chord; the tolerance is 0 to 6 px

PNG to DXF in millimetres: what is different here

  • No half-pixel shift

    The boundary runs along pixel edges, not through their centres.

  • What you see is what is cut

    The output is straight segments. The SVG and the DXF are written from the same points and carry the same layer names.

  • The threshold is a number, not a guess

    Otsu calculates it and shows it as a number; you can override it by hand from 1 to 254.

What it cannot do: letters, curves, repairing a bad picture

It does not recognise letters: a vectorized word is a set of outlines, not text, and its font cannot be changed. It does not fit Bézier curves: the contour is segments, and smoothing adds points.

It does not repair a bad picture: a blurred or heavily compressed raster gives a jagged contour. One picture is accepted at a time. Black and white gives one layer; for several layers, use colour.

Questions about PNG to DXF and vector files

How to convert PNG to DXF?

Drop the PNG, choose a threshold or a number of colours, set the width in millimetres and press “DXF R12”. The file is in millimetres, with a closed polyline for each contour.

How to turn a picture into a vector file?

Drop the photo or logo, choose black and white or colour, set a width from 10 to 600 mm and download SVG or DXF R12.

What is the difference between raster and vector?

A raster is a grid of coloured pixels and blurs when enlarged. A vector describes lines and scales without loss. A laser, a plotter and a router follow lines, so they need a vector.

Which files does it accept and download?

It accepts PNG, JPG, WEBP, GIF and BMP, one file at a time. It downloads SVG in millimetres and DXF R12.

How much does it cost to turn an image into a vector file?

15 EUR a month, as part of Pro. Pro also opens the other Pro tools in the catalog.

Images to DXF and SVG is part of Pro

Pro costs 15 EUR a month and opens all 45 Pro tools.

In the Design group:

Turn your image into a vector file

Part of Pro, 15 EUR a month.