png23d(1) -t 0 -w 120 -d 40 -o stl -f surface -l 256 map.png map.stl
PNG to 3D file conversion
-t     The  colour  which  is  used  for  transparent  output. Valid range is 0 to 255(default) or 'x' to
       disable.
-w     The output target width (x dimension). The source PNG width is used by default.
-d     The output target depth (z dimension) The number of levels specified is used as the default.
-o     Specifies the output type

       pgm     Output  a  PGM  format  bitmap.  This  can  be  used  to verify the level and quantisation
               parameters are set correctly.
       rscad   Output a scad format file for use with OpenSCAD.  This file will be comprised of  a  union
               of cubes. The finish cannot be controlled (it is raw blocks) and the resulting scad object
               may be very complex.
       scad    Output a scad format file for use with OpenSCAD.  This file will be comprised of a  single
               polyhedron  mesh.   For  larger  images this polygon will be exceptionally complex and may
               contain many thousands of triangles.
       stl     Output a binary stereolithography format  file.   These  files  are  comprised  of  simple
               triangles,  the output can be directly used by several 3D printing systems.  The generated
               meshes are a convex manifold but are not simplified.
       astl    Same as the stl entry but generates a textural file instead of binary.
-f     Specifies the finish out the output 3D mesh the default is cube which keeps all  the  cube  faces.
       The  smooth option uses a marching square algotithm to gives sloped edges and reduces jaggies. The
       rect finish is for the rscad output type only. The  surface  type  generates  a  simple  heightmap
       surface.
-l     The number of levels into which the colour-space is divided. Valid range  is  1(default)  to  256.
       Note  that  as of version 1.0 not all output generators obey this parameter or may use a different
       finish type to that specified if the parameter is not 1.
source manpages: png23d