G-code Heightmap Plate
Turn any ComfyUI image into a 3D-printable relief plate — G-code straight from pixels
- image
- profile
- plan
- preview
- plan_info_json
- summary
This is the node that makes people do a double take: you drop an image in, and it writes a full toolpath to 3D-print that image as a relief plate - no slicer involved. It's the closest thing this pack has to a party trick, and it's genuinely useful if you make lithophanes, topographic maps, or embossed signage. Feed it any IMAGE (say, the output of a KSampler or an upscaler) and it walks the luminance values as height.
How it works
The image is converted to grayscale and resampled onto a grid spaced at your line_width_mm, so each pixel becomes a printable cell. Height comes from brightness: the plate starts with base_layers of solid foundation, then luminance adds up to relief_height_mm on top. Dark pixels sit low, bright pixels sit high - or flip it with invert_heightmap if you want the opposite.
Then it writes the raster path itself, line by line, in the direction chosen by fill_mode: alternate_xy does boustrophedon (back-and-forth, alternating axes each layer, good for even stress), x_only and y_only rasterize in one axis. It only extrudes where the layer's height contour exists, so the toolpath stays lean. blur_radius_px and height_gamma smooth or stretch the relief before the grid is sampled.
The result is a complete MKR_GCODE_PLAN - the same type the spiral vase emits - plus a top-view preview image so you can eyeball the path before it touches a printer.
Inputs that matter
image- the source; the first image in the batch is used.width_mm,height_mm- physical footprint of the printed plate (default 80×80 mm).base_layers- solid foundation (default 3). Each layer islayer_height_mmthick.relief_height_mm- how much vertical variation the image gets (default 1.6).layer_height_mm,line_width_mm- print resolution. Smaller = finer detail but way more moves.fill_mode,invert_heightmap,mirror_x/y,blur_radius_px,height_gamma- the path-shaping controls.
There's also an optional profile input. Leave use_profile_defaults false and the node uses the standalone speed/width settings; flip it on and line width, layer height, and speeds come from your MKR_GCODE_PROFILE instead. That's the better move once you've tuned a profile you trust.
Outputs
plan (MKR_GCODE_PLAN) feeds MKRGCodePreview and MKRGCodeExport. preview is a rendered look at the path. plan_info_json and summary give you stats - layer count, print moves, physical size - so you can sanity-check before exporting.
Installing it
Same as the whole pack:
# ComfyUI Manager: search "MKRShift Nodes", install, restart.
# or:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
# restart ComfyUI
Pure Python + Pillow/numpy/torch. No models, no slicer needed - this node is the toolpath generator.
The honest caveats
A few things to know before you waste filament. First, this is relief-only: it's a 2.5D raster, so there are no overhangs and no support. Fine for plates and lithophanes, wrong tool for anything with real geometry. Second, resolution is expensive - halve line_width_mm and you quadruple the move count. A detailed A4 plate can be a many-thousands-of-lines file and a long, long print. Run it through MKRGCodePlanAnalyzer first and let it tell you the estimated time and cost before you commit. And third, the first frame of the batch is used, silently - if you hand it a 4-image batch expecting 4 plates, you'll get 1. Feed single images unless you've confirmed the behavior.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| settings_json | STRING | {"width_mm":80.0,"height_mm":80.0,"base_layers":3,"relief_height_mm":1.6,"layer_height_mm":0.2,"line_width_mm":0.45,"fill_mode":"alternate_xy","invert_heightmap":false,"mirror_x":false,"mirror_y":false,"blur_radius_px":0.0,"height_gamma":1.0,"print_speed_mm_s":28.0,"travel_speed_mm_s":120.0,"use_profile_defaults":false} | — |
| profileopt | MKR_GCODE_PROFILE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| plan | MKR_GCODE_PLAN | — |
| preview | IMAGE | — |
| plan_info_json | STRING | — |
| summary | STRING | — |