From Gentoo Wiki
Jump to:navigation Jump to:search
This page has been nominated for deletion.

The given reason is: Abandoned software not in Gentoo

If you disagree with its deletion, do not remove this notice; discuss your objections on the associated discussion page.

Administrators, please remember to check if anything links here and the page history before deleting.

This notice should remain for a minimum of 1 month after it was placed on the page. If discussion is still ongoing it should remain until a consensus is reached, at which time the page may be deleted or this notice may be removed. (However, if the page has only been edited by the user who nominated it for deletion and/or is in the nominator's user space, then a speedy deletion may be called for.)

Designed by Vincent Sanders and released under MIT license, PNG23D is a command line tool allowing to make a 3d file from a PNG image.

Different picture densities define different heights in 3d file generated. All the hard work is to customize source pictures, accorded to PNG23D settings, to get good printing files.

Many parameters can be set, among others: 3d object sizes, height levels number, output format –for example an .stl file to be printed, or a .scad one to be edited in OpenScad (media-gfx/openscad), etc.


PNG23D is not in Portage tree or Gentoo overlays, so installation is done by compiling sources found on GitHub.

Before compiling, as PNG23D relies on the libpng library for its PNG image handling (Vincent says), be sure that media-libs/libpng is installed:

user $emerge --info libpng

If not:

root #emerge --ask media-libs/libpng

Then clone Git repository, for example in /usr/src:

root #cd /usr/src

Compiling and installing:

root #cd /usr/src/PNG23D
root #make && make install

An Error?

If ‘STDIN_FILENO’ undeclared error is generated after make…:

CODE ‘STDIN_FILENO’ undeclared error
bitmap.c:46:25: error: ‘STDIN_FILENO’ undeclared (first use in this function)
         fp = fdopen(dup(STDIN_FILENO), "rb");

… add #include <unistd.h> at the beggining of /etc/src/PNG23D/bitmap.c:

FILE /etc/src/PNG23D/bitmap.cEditing bitmap.c
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h> /* added line */
#include <png.h>
#include "bitmap.h"

Then compile again.

Without Git

Alternatively without git, sources can be downloaded, unziped an compiled in another location.

Man Page

For the man page to be installed, be sure that /usr/local/share/man/man1 directory exists, create it if needed:

root #mkdir -p /usr/local/share/man/man1

Then install the man page (which will later be accessed by man png23d):

root #make install-man


Simple usage making an .stl file:

user $png23d -o stl /path/to/input/file.png /path/to/output/file.stl

And making an .scad file:

user $png23d -o scad /path/to/input/file.png /path/to/output/file.scad

External resources