Back to blog

How to Make a Depth Map from a Photo for Laser, CNC and 3D Printing

Make a depth map from a photo with an AI depth model, then use it for laser engraving, a CNC relief or a 3D printed STL. White is high, and 16-bit can matter.

ImgToSTL TeamBy ImgToSTL Team
How to Make a Depth Map from a Photo for Laser, CNC and 3D Printing

A depth map is the file behind most carved photo reliefs: a pet portrait engraved into slate, a family photo milled into a walnut plaque, a printed relief of a face that catches the light from the side. It is a grayscale image where brightness stands for height. You cannot get one by converting a photo to black and white, and that is the mistake most first attempts make.

This guide covers how to make a depth map from an ordinary photo, which file to save, and how to use it on a laser, a CNC router or a 3D printer. Every third-party tool, license and software feature below was checked on the maker's own pages on October 17, 2026.

The short answer

  1. Start from the job. Laser engraving, CNC carving and 3D printing all read the same kind of image, but they need different amounts of precision.
  2. Make the depth map with an AI depth model, not by desaturating the photo. Depth Anything V2 and Marigold are two open models with free online demos on Hugging Face.
  3. Save a 16-bit PNG when your software reads one, and an 8-bit PNG otherwise. Never use JPG for the final map.
  4. Check that white is high. If the subject comes out sunken, invert the image.
  5. Test before the real piece: an offcut for the laser, an air cut or soft wax for the CNC, a small draft print for the printer.

Depth map vs heightmap: white is high

Both are grayscale images where each pixel stores one number. The difference is what the number means.

  • A heightmap stores height above a base. In terrain data, displacement maps and carving software the convention is white for the highest point, black for the lowest, and every gray in proportion.
  • A depth map stores how far each point is from the camera. Depending on the tool, near can be bright or dark. Depth Anything V2 shows near as bright; Marigold stores near as dark.

For a relief you want the heightmap reading: the dog's nose, closest to you, is the highest point and the background is the lowest. So whatever tool makes the map, the file you carve or print should be near = white = high. If the face sinks into the panel instead of rising out of it, invert the image.

Why photo brightness is not depth

The tempting shortcut is to load the photo itself and let brightness become height. It fails on almost every photo of a real object, because brightness in a photo records light and color, not shape:

  • A black dog on a white rug carves as a deep trench in a raised floor.
  • A white shirt stands higher than the face above it.
  • The shadow under a chin becomes a hole, and the highlight on a cheek becomes a bump.

Brightness as height works when tone really is the design: a logo, a line drawing, a lithophane, or an image that already is a heightmap. For a photo of something three-dimensional, a depth model has to estimate how far away each point is, and that estimate is what you carve.

AI depth options (checked October 17, 2026)

Depth Anything V2

Depth Anything V2 was released in June 2024. It comes in Small (24.8M parameters), Base (97.5M) and Large (335.3M) sizes; a Giant size is listed as coming soon.

  • License: Small is Apache-2.0. Base and Large are CC BY-NC 4.0, which rules out commercial use. If you sell engravings, read the license or use the Small model.
  • Output: relative depth, stored as inverse depth, so near areas get high values and show as bright. The grayscale map is already white-is-high.
  • Online demo: the official Hugging Face Space runs the Large model for free within Hugging Face's daily GPU allowance (2 minutes without an account, 5 minutes with a free one, per Hugging Face's ZeroGPU docs). It offers an 8-bit grayscale PNG, stretched to use the full black to white range, and a "16-bit raw output" file. The 16-bit file holds the model's raw values without that stretch, so expand it to the full range with Levels in a 16-bit editor before you carve from it.

A metric version that predicts depth in meters also exists, but a relief does not need real distances. Its successor, Depth Anything 3, was released in November 2025; its single-image model DA3MONO-LARGE is Apache-2.0 and predicts depth directly rather than inverse depth, so check which way round its output is.

Marigold

Marigold builds its depth estimator from Stable Diffusion and was presented at CVPR 2024. The current version is Depth v1.1, from May 2025.

  • License: the code is Apache 2.0; the model weights use the RAIL++-M license.
  • Output: relative depth from 0 at the near plane to 1 at the far plane, so near is dark. Invert it before you carve or print.
  • Online demo: free on Hugging Face's ZeroGPU, and it offers a true 16-bit PNG, with values spread linearly over the full 0 to 65,535 range.

The same team publishes a separate Space, Depth To 3D Print, that turns a 16-bit depth PNG into a watertight bas-relief and downloads it as STL, OBJ or GLB. It does not estimate depth itself: you make the map in the Marigold demo first.

Apps

  • Immersity AI, the app formerly called LeiaPix, exports depth maps as 16-bit PNG with lighter areas closer. Its FAQ says the web version has no free trial.
  • Apple Depth Pro (October 2024) predicts metric depth in meters, more than a relief needs. Its weights on Hugging Face are licensed for research only.

Whatever the tool, three habits help:

  • Crop tight and simplify the background. A depth model spreads its range across the whole frame, and a far wall or sky uses up levels that the subject needs.
  • Cut out the subject if only the subject should be carved. A clean mask turns the background into one flat, lowest level.
  • Expect relative depth. These models rank what is nearer and farther; they do not measure millimeters. You choose the real relief depth later, in the laser, CAM or STL settings.

8-bit vs 16-bit: 256 vs 65,536 levels

An 8-bit grayscale image has 256 possible levels; a 16-bit one has 65,536. Spread over the relief depth, that sets the size of the smallest step:

Relief depth8-bit step16-bit step
3 mm0.012 mm0.00005 mm
10 mm0.039 mm0.00015 mm
25 mm0.098 mm0.0004 mm

Whether that matters depends on the machine:

  • 3D printing: a printer builds height in layers of 0.1 to 0.2 mm, so a relief printed flat cannot show steps finer than a layer anyway. 8-bit is enough for most printed reliefs.
  • CNC: a fine finishing pass can show 0.1 mm terraces on gentle slopes such as cheeks or rolling terrain. Vectric's own help pages warn that 8-bit images can show up as concentric plateaus in the 3D model. For deep carvings, 16-bit is worth it.
  • Laser: LightBurn's documentation recommends a 16-bit image once a 3D engraving runs more than 256 passes. With fewer passes, 8-bit already has a gray level for every pass.

Two traps. Baseline JPG holds 8 bits per channel and adds compression blocks, so save depth maps as PNG, which supports 16-bit grayscale. And some image editors save a 16-bit PNG back as 8-bit, so check the bit depth after any edit.

Laser engraving: test on an offcut

Laser software engraves a grayscale image by brightness. In LightBurn's Grayscale mode, the lightest shades get the minimum power and the darkest get the maximum. Its 3D Sliced mode, available only for galvo lasers, burns the darkest shades with the full number of passes and pure white with none, and it reads 16-bit depth maps from LightBurn 2.1. Both modes have a Negative Image option that flips the image.

With a white-is-high depth map, the dark background burns deepest and the near parts of the subject stay closest to the surface, which is the right way round. If it comes out inverted, turn on Negative Image rather than making a new map. Marigold maps, where near is dark, need that flip.

The material decides as much as the file. Birch, walnut, slate and anodized aluminum respond very differently to the same gray levels, and even two boards of the same wood can differ. Before the real piece:

  1. Engrave a small ramp of ten gray steps, from white to black, on an offcut of the same stock.
  2. Note where the darkest steps stop getting deeper. That is your useful power ceiling.
  3. Note where the lightest steps stop marking at all. That is your floor.
  4. Set the job's power range between those two, then engrave the depth map.

CNC: relief depth vs bit reach

On a router, the depth map becomes a toolpath, and the limit is usually the bit, not the file.

  • Relief depth is the distance from the highest point to the background. Choose it for the piece, not the image. A few millimeters already reads as 3D on a wall plaque; going deeper looks more dramatic but needs longer bits and more machine time.
  • Bit reach is how deep the bit can cut a narrow valley before its shank or the wider part of the flutes hits the walls. A small ball-nose bit gives fine detail but has short flutes. If the relief is deeper than the bit can reach on its steepest sides, lower the relief depth or use a tapered ball-nose bit.
  • Stepover sets the ridges left between passes. With a 3.175 mm (1/8 inch) ball-nose bit at a 10% stepover, those ridges are under 0.01 mm tall. Large stepovers on hard woods leave visible lines across the image.
  • Rough first, then finish. A flat-end bit clears most of the material quickly, and the ball-nose bit only takes the last skin.

Some CAM programs read the image directly. Vectric Aspire has a Create Component from Bitmap tool that turns an image into a 3D component, and Carveco has a New Model from Image option, depending on the license. If yours does not read images, use an STL instead: the same depth map becomes a closed 3D model that any CAM program can machine. On a CNC the stock itself is the base, so keep the base thin.

3D printing: turn the depth map into an STL

A depth map is already a heightmap, so making it printable is a direct conversion. On JPG to STL:

  1. Load the depth map as PNG, JPG or WebP, up to 10 MB.
  2. Choose Relief as the output type.
  3. Open Advanced settings and turn on Raise light areas instead. Relief mode raises dark pixels by default, which suits ink on paper, but depth maps and heightmaps use white for high. Leave it off for a Marigold map that you have not inverted.
  4. Set Size (the longest side), Relief height and Base thickness. 100 mm with 3 mm of relief on a 2 mm base is a good start, and the relief height goes up to 16 mm.
  5. Pick Fine detail for faces and fur. It samples the image at up to 320 points along the longest side, about one every 0.3 mm on a 100 mm panel.

The 3D preview is free and needs no account. Downloading the STL costs 2 credits, and new accounts get 10 free credits, enough for 5 STL downloads. The image is processed in your browser and never uploaded.

Two honest limits. This tool reads brightness as height, so it turns a depth map into an STL but does not estimate depth from an ordinary photo; make the map first. And the browser reads images at 8 bits per channel, so a 16-bit PNG gives the same mesh as an 8-bit one here. Relief mode smooths the surface slightly, and at printed relief heights the layer lines hide the rest. If you want the full 16 bits in the mesh, the Depth To 3D Print Space mentioned above takes 16-bit PNGs.

Print the relief flat on the bed with 0.12 mm layers for smooth slopes. For a deeper, finer relief, scale it up rather than only raising the height: gentle slopes print better than steep walls.

Troubleshooting

  • The subject is sunken instead of raised: the map has near = dark. Invert it, or toggle Raise light areas instead in JPG to STL.
  • The background stands up like a wall: the depth model placed it too close. Crop tighter, or cut out the subject and fill the background with black.
  • Stair steps on smooth areas: the map is 8-bit, or it was saved as JPG. Export a 16-bit PNG if your software reads it, or blur the map slightly.
  • The relief looks flat: the depth range went to the background. Crop, or stretch the subject's grays with Levels so they use the full range from black to white.
  • Fuzzy noise on fur or grass: the fine detail is too busy for the material. Blur the map by one or two pixels, or carve with a larger bit.
  • A halo around the subject: depth models smear the edge between near and far. Clean the edge with a mask before carving.
  • The laser burns everything too dark: the power range is too wide for the material. Go back to the test ramp and narrow it.
  • The CNC bit cannot reach the bottom: the relief is deeper than the bit's reach on its steep sides. Reduce the depth or switch to a tapered ball-nose bit.

Where to go next

Have a depth map already? Load it into JPG to STL with Raise light areas instead turned on and check it in the 3D preview. For flat artwork rather than photos, how to convert an image to STL covers reliefs, lithophanes and cut-outs, and how to turn a photo into a 3D model covers full 3D models from a photo.

Sources (checked October 17, 2026)