PNG23D logo by kyllikki
PNG23D is a 3d mesh generation tool.

This tool converts images in the PNG image format into a 3 dimensional representation. Two output formats (OpenSCAD and STL) are currently supported with several options for output parameters.


The task this utility performs is straightforward to describe, if a little more challenging to realise. The conversion of a two dimensional image into a three dimensional form requires construction of that dimension from an existing image property.

If the x and y dimensions are used directly from the image the only remaining source of information is the pixel colour. From the image a heightmap is constructed and used to generate the additional dimension information.

The operations used to perform the conversion are:

  1. Read, decode and process the source image into a greyscale bitmap.
  2. Generate a triangle mesh creating a manifold polygon.
  3. Index the vertices of the generated mesh.
  4. Simplify the generated mesh.
  5. Write the generated mesh to output file in selected format.

Each of these steps is the subject of academic study and could be extended beyond the basic algorithms currently used to obtain "better" results

The "best" output is difficult to define as for one application it could mean a mesh which is faithful to the source image but for a different application it could mean an approximation that has a low face count. The command line parameters give control over the steps to allow for these differing requirements, these are documented in detail in the usage section.

The mesh generation strategy has the largest influence on the final model. The utility, as of version 1.1, has two general purpose and one narrow purpose generators giving some flexibility to the user.

The aim of the mesh simplification step is to reduce the number of faces and vertices without detrimentally affecting the models topology. The implementation as of version 1.1 only allows for a single simplification method. The half-edge remove method implemented produces adequate results for synthetic models with mainly planar faces but fares poorly on other mesh types.

Downloading and Building




Released under the MIT License


Vincent Sanders (