How to convert png to stl?

  • Is it possible to convert an image image to STL file format?

    png image

    E.g. I don't need the coloring, I need the lines.

    You need to clarify what you want. A thin slab of everything but the white/transparent parts of the image? Black strokes only with some thickness to them? Raised black strokes on top of a slab of the whole thing? Something else entirely?

    Dont need color. Only to test. you can convert to me?

  • I suggest your objective can best be accomplished by converting the image to a single color vector file. You can do this with Inkscape (free, Linux, Windows, Mac) by combining the built-in bitmap tracing feature with some manual editing. I attempted to do so, but the coarseness of the image would result in excessive manual edit time. It may even be faster to reduce the opacity of the image and create a manual tracing on a second layer.

    Once you have a vector file, you can use any number of 3D modeling programs to convert the file to a 3D STL. Fusion 360, Tinkercad and OpenSCAD allow import of SVG files to be extruded to user-specified thickness.

  • PNGs are 2-dimensional picture data files. STL however is a 3-dimensinal surface data files. The two are not inherently transformable into one another, as there simply is no 3rd dimension encoded in the PNG.

    However, there are ways to generate a 3rd dimension from a color picture:

    • Lithophanes take color information and use that as a degree of deviation from a base plane.

    • Using 3D design software that supports importing image data, one can trace the areas in 2D and extrude them to different heights or emboss the patterns into a block, even with different depths for each color.

  • First you need a single color png image, you can do this by opening the file in any image editor (even Paint included with Windows) and painting white over all the colored pixels (more advanced image editors maybe able to do this automatically).

    Then you can use OpenSCAD (free download from, enter the following code: (obviously, replace the file path with your own)


    Now press F5 (at this point you'll see a low quality preview), then F6 (to do a full render and view an high quality preview), then F7 to save the STL

    The resulting model will be higher then you want but you can scale the result STL in your slicer (or use the OpenSCAD scale command if you prefer code)

  • For things like a coat of arms, you do not require a full 3D conversion, essentially all you need is a lithograph-like effect. The best program I've found for such conversions is 3D Builder which is a free Microsoft download for windows users (yes, I was surprised too). It can use either color or degrees of greyscale shading to determine the z-axis depth of each region in the picture. Makes the cleanest conversion I've found so far. Exports as a .3mf file but can be readily converted to an .stl for 3D printing (using something like SwiftConverter for example). Also has an option to invert the conversion which I've found quite useful.

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM

Tags used