Dmap2gcode generates g-code to cut depth
based on a gray scale image darkness or lightness


Sample Output
Related Links


Dmap2gcode is a depth map image cutting program written in python. This program is based on image-to-gcode depth map milling program that is integral to LinuxCNC. The name dmap2gcode is an abbreviated description of the function of the program (Converts depth maps to G-Code). A depth map is a grey scale image where the darkness or lightness of each pixel corresponds to the depth (or height) of the object at each point. Dmap2gcode is a free open source program released under the GNU General Public License (GPL) Version 3. Most of the core functions are unchanged from the predecessor program (image-to-gcode). The changes in dmap2gcode include a new graphic user interface (based on F-Engrave) decoupling the code from the LinuxCNC distribution and some additional options have been added. Decoupling dmap2gcode from the LinuxCNC distribution will now allow windows and Mach3 users easy access to the program capabilities.

dmap2gcode Features

- Generates g-code based on image input and user settings
- Option to disable cutting of the top surface. (allows stock top surface to remain)
- Option to offset the step over (allows cutting between previously cut scan lines)
- Option for vertical or arc plunge start
- Text input for v-bit angle (if v-bit is selected)
- Complete set of roughing configuration options
- Origin selection allows user to select the location of g-code zero position
- Use inches or mm as export units
- Customizable g-code preamble and postamble
- Opens previously saved g-code file and retrieve the settings
- Roughing g-code is saved to separate file to allow tool change between roughing and finish cut.
- Imports a variety of image files (including jpg, gif, png, pgm)

Changes in Version 0.01

- Initial Release

Changes in Version 0.02

- Fixed bug resulting in the selection of columns then rows having no effect
- Added option to disable arcs in the g-code output (useful for GRBL/ShapeOko)
- Added automatic scaling of all linear dimensions values when changing between units (in/mm)
- fixed bug when using a configuration file ("dmap2gcode.ngc")

Changes in Version 0.03

- Fixed bug that caused crash when the image file name contained non ASCII characters.

Changes in Version 0.04

- Fixed bug that caused crash when roughing cutter is smaller than final cutter.

Changes in Version 0.05

- Eliminated G91.1 code when arcs are disabled. (Caused problems with TinyG)

Changes in Version 0.06

- Fixed GUI refresh (get rid of red warning) after a bad value was entered for "Top Tolerance"
- Fixed compatibility with Python 3
- Added .tap to extension list

Changes in Version 0.07

- Added save configuration button in general settings
- Added logic to make PIL loading work with more python variations
- Fixed settings reading problem with feed rates, cut perimeter and arc fitting
- Removed coolant related M codes from header and footer
- Removed automatic G64 insertion (now it must be handled in the g-code header)

Changes in Version 0.08

- Added ability to use pipe characters (|) to create carriage returns in the g-code header and postscript.

Changes in Version 0.09

- Changed the default settings to be compatible with more g-code interpretors
- Added option to suppress comments in output g-code file (default is now suppressed)

Changes in Version 0.10

- Fixed error message when unable to open file the wrong file name appeared.
- Removed some library loading code that was causing erratic behavior.

Changes in Version 0.11

- Made changes to be compatible with the latest PIL and NUMPY

Changes in Version 0.12

- Made additional changes to be compatible with modern latest PIL and NUMPY
- Fixed tool-path problem when using cut perimeter option
- Added cut perimeter option to roughing menu
- Added support for 16 bit gray scale images for better depth map resolution

Changes in Version 0.13
- Made change to be compatible with modern PIL release (replace .ANTIALIAS with .LANCZOS)


(Right click on the link and select "Save target as" or "Save link as")
Source files
(zip file)
Windows Executable Files
(zip file)

If the windows executable does not work right away install the
“Microsoft Visual C++ 2008 Redistributable Package (x86)”. The program I use to create the Windows executables (py2exe) has a dependency to this package.


I have started the manual page for dmap2gcode here: dmap2gcode manual

Sample Output

Green Lake Picture
The g-code for this lake map was produced by dmap2gcode. The text g-code was produced in
F-Engrave. The map was carved into plywood. The glue, which is red for this plywood, forms contour lines between each plys. Too bad the plywood glue is not blue.

Green Lake Picture
Some more lake maps that have been carved. The map in the upper right is carved into a hand laid up plywood consisting of alternating walnut and birch veneer. The map in the lower right has the surrounding roads and title protruding up from the main shoreline surface.

Lake Map Video (How Make a Lake Map - Overview)

This video shows the process I used to make the smooth contour lake maps.

Related Links

image-to-gcode page: The core functions of dmap2gcode come from image-to-gcode.
F-Engrave: Used to create the V-Carved text on the lake map plaques shown above.
MAKE: Laser-Cut Bathymetric Charts: This blog post motivated me to finish this project.

Scorch's Home
Scorch Works Home
Scorch Works Blog
@scorchworks On Twitter