Depth Map to STL

Depth Map to STL

Turn a depth map or image into a watertight 3D relief with a flat back. Set width, base and height, preview it in 3D and download STL, OBJ or 3MF.

3D Printing

Your image never leaves your browser: meshing and STL/OBJ/3MF export happen on your own device.

Examples
Dimensions

Each option sets the height in proportion to the model's longest side: Subtle 1/30, Standard 3.5/60 and Bold 1/10.

The tallest point of the model is exactly this high above the base; everything else is shared out below it. From 0.2 to 50 mm. Raising the height scales the whole relief evenly: nothing is enhanced.

0
Relief shape
0 %

How much height is taken from the big jumps (the gap between two people, an arm reaching towards the camera) and given to the shape of each subject. The relief follows the estimated depth: nothing is added or enhanced.

10 %
Background

Without a background the model is the subject alone: its outline, the base underneath and the relief on top. The empty background does not count towards the heights: the darkest tone of the subject becomes base level (plus the edge step), white stays the maximum height, and each separate figure starts from the base.

Without a background only. Unticked, each person comes down until they stand one small step above whoever is behind them, and the height that saves goes to the faces. Ticked, whoever is in front stays as far forward as in the map, and the control below does nothing.

0 %

Without a background only. Lowers the outline of each figure towards the base and leaves the height to the shape inside: 0%, the default, keeps the distances that are left and 50% is the most it goes. It adds no shape: it only removes a gentle offset, and what is inside gets a little steeper. A portrait of one person gains the most; it stops at 50% because beyond that, on our test photos, a group broke into separate fins.

1 %
Frame

Keywords

depth map to stlimage to stlheightmap to stlpng to stl reliefbas relief generatorlithophane stl3d relief from photo

Need something else?

How to use

1

Drop a depth map onto the page (a 16-bit PNG from Image to Depth Map keeps the most detail) or any ordinary image, which is read by brightness. You can also open Examples, or arrive here with Turn into 3D from the depth-map tool.

2

Set the physical size: the width in millimetres (the height follows the image's aspect ratio), the thickness of the flat base, and the maximum relief height. The tallest point of the model ends up exactly that high above the base.

3

Choose how the relief is shaped (linear depth, or depth compression for photos of people) and what happens to the background: a flat plate, or nothing printed around the subject. Then pick the detail, smoothing, invert or a frame.

4

Turn the 3D preview with the mouse or a finger, use Fit to recentre it and Wireframe to see the triangles. The summary shows the final size, the triangle count and the detail actually used.

5

Download STL, OBJ or 3MF, or press Slice it to open the model in the online STL slicer and get G-code for your printer.

Features

Watertight by construction

The top surface, a flat back and the side walls are built together, so every edge is shared by exactly two triangles. That holds for a rectangular plate and for a subject printed without its background, whose walls follow its outline. No repair step is needed and slicers accept the mesh as a solid.

Real millimetres

Width from 5 to 1,000 mm, base from 0.4 to 20 mm and relief from 0.2 to 50 mm. The part comes out at that size in any slicer: 3MF records millimetres explicitly, and STL and OBJ are written in millimetres, which is what 3D printing software assumes.

Detail you choose, a size you can print

Pick a grid spacing from 0.1 to 0.8 mm. If the result would exceed one million triangles, the spacing is coarsened automatically and the summary tells you the detail actually used, so the file stays manageable in a slicer and in the browser.

Optional raised frame

Add a border of any width and height around the relief, for a picture-frame edge or a plaque rim. It is part of the same watertight surface, not a second object glued on.

Live 3D preview

A WebGL view shows the relief exactly as it will be exported. Rotate, zoom and switch to wireframe to judge whether the detail setting is fine enough before you spend time on a print.

Why Choose This Tool?

Nothing is uploaded

Meshing and export happen in a background worker on your own device. The picture, the depth map and the resulting model never leave your browser, which matters for personal photos, client logos and designs you have not released.

One pipeline from picture to print

Make the depth map with Image to Depth Map, turn it into a relief here, and slice it in the online STL slicer. Each step hands the result to the next in the same browser, with nothing to install and no file shuffling in between.

A clear, documented method

The page explains exactly how the mesh is built: the grid, the way each square is split, the flat back and the walls, and when detail is reduced. You can predict the result, instead of guessing what a black-box converter did.

Files every slicer reads

Binary STL for maximum compatibility, OBJ for modelling software, and 3MF, the modern 3D printing format that carries its unit with it. The same mesh is written to all three.

From depth map to printable relief: how the mesh is built

A depth map is a grid of numbers. A 3D printer needs a closed surface made of triangles. This tool turns one into the other in a way that is simple enough to describe completely, which is what this page does. Everything below is the method the tool actually uses.

1. Reading the depth map

A 16-bit greyscale PNG, like the ones Image to Depth Map exports, is read at full precision, 65,536 levels. Any other image is read by brightness: the Rec. 709 luma of each pixel multiplied by its alpha, so a transparent background becomes the lowest level. Either way the result is a map of values from 0 to 1, where 1 is nearest and becomes the highest point of the relief. Invert flips that, which is what you want when dark should be high, as in a lithophane. Smoothing applies a three-pass box blur to the map before it is resampled onto the grid.

2. Laying a grid in millimetres

You choose the width; the depth follows the image's aspect ratio. The detail setting is the target spacing between grid points, 0.2 mm by default. A 100 mm wide image with a 4:3 aspect ratio at 0.2 mm spacing gives a grid of 501 × 376 points. The spacing is adjusted separately along each axis so that the grid ends exactly at the edges of the part. The depth map is then resampled bilinearly onto that grid, so its resolution and the mesh resolution are independent: a small image can make a large relief, it will simply be smooth.

Each grid point gets a height: base + maximum relief height × depth, with the depth rescaled so that its highest value is exactly 1. With a 2 mm base and a 5 mm maximum, the lowest point sits at 2 mm and the tallest at exactly 7 mm. The summary shows both numbers for the model as built.

Shaping the relief: why a face comes out flat, and depth compression

In a photo of several people, most of the depth range is the distance between them: one person stands in front of another, an arm reaches towards the camera. Scaled linearly into 5 mm, those jumps take nearly all the height and a nose is left a tenth of a millimetre proud of the cheeks. On our test photos the steps between subjects carried 41 to 47 % of all the depth change while covering under 6 % of the subject.

Sculptors solve this the way a coin does: the gaps are squeezed and the shapes kept. Depth compression does the same with the method Weyrich and colleagues described for digital bas-relief, built on the gradient-domain compression of Fattal, Lischinski and Werman. The tool measures the slope of the depth at several scales, shrinks the steep slopes (the jumps) by a factor that grows with their size, leaves gentle slopes as they are, and rebuilds the surface that best fits the new slopes by solving a Poisson equation inside the subject. Slopes are only ever reduced, never increased or reversed, and no brightness, edge or texture from the photo is used: the relief follows the estimated depth and nothing is added to it. The height the jumps give up is what the faces gain when the result is stretched to your maximum height.

Linear depth turns this off and is the right choice for a height map you drew yourself. Balanced (30 %) is the default for a depth map estimated by AI, and Faces / portrait (85 %) flattens the gaps further. Because the surface is rebuilt as a whole, the order of two distant points can change slightly at high settings; the direction of the slopes does not.

Printing the subject without its background

What is background should not have to be printed. When the map knows where the subject is (a cut-out from the Background Remover, a PNG with transparency, or the Treat black as background option for a plain map), choose Don't print the background. The model is then the subject alone: its outline, the base thickness underneath and the relief on top, with vertical walls. The heights are worked out in a fixed order. The empty background does not count. Inside the subject the levels are stretched, so its darkest tone becomes base level, plus the step at the edge, and white stays the top; each separate figure starts from its own darkest tone, so one that stands farther back does not sit on a block. Only then are the levels turned into millimetres, with white at the relief height you set.

The outline is traced between grid points with marching squares, so it is a smooth curve rather than a staircase of pixels. Before tracing, anything narrower than Smallest outline feature (0.8 mm by default, two nozzle widths) is removed, because a stray wisp of hair would otherwise become a spike no printer can make, and specks under 2 mm² are dropped and reported. If the subject is several separate shapes, the tool says how many pieces the model has: they print loose. Use the flat plate to keep them together, or a rim, a band at base height around the subject that also joins pieces lying close to each other.

3. The top surface and the diagonal choice

Every square of the grid becomes two triangles. There are two ways to cut a square in half, along one diagonal or the other, and on a curved surface they give different shapes. The tool compares the height difference along each diagonal and cuts along the one where the difference is smaller. That keeps ridges running along ridges and valleys along valleys, instead of producing a saw-tooth pattern where a sharp edge crosses the grid at an angle. All triangles are wound counter-clockwise seen from above, so their normals point out of the part.

4. Closing the solid: flat back and walls

A surface alone is not printable; it has to enclose a volume. The back is a flat plane at zero height built as a fan: triangles from a single centre point to each segment of the outer edge. Because the fan uses exactly the same edge points as the surface, the two meet without gaps. The walls are one vertical quad (two triangles) per edge segment, from zero height up to the surface. The result is watertight and manifold: every edge belongs to exactly two faces and all normals point outward, which is what the STL printability checker looks for and what slicers require.

The optional frame pads the grid with extra points around the image, set at base + frame height, so the border is part of the same continuous surface.

5. The triangle budget

The number of triangles is two per grid square plus three per edge segment for the back and walls. The 501 × 376 grid above gives 380,250 triangles, a binary STL of about 19 MB. Halving the spacing multiplies that by four. To keep files usable in a slicer and in the browser, the tool caps the model at one million triangles: if your settings would exceed it, the spacing is increased by 10 % at a time until the model fits, and a note shows the detail actually used. At 0.1 mm on that same 100 × 75 mm part, the tool settles on about 0.13 mm.

Finer spacing than your nozzle can reproduce buys nothing. A 0.4 mm nozzle draws lines 0.4 mm wide, so for most reliefs 0.2 mm is already finer than the print; 0.1 mm is worth it for small, highly detailed pieces or resin printers.

6. STL, OBJ or 3MF

  • STL (binary) is the format every slicer reads. It stores each triangle as twelve 32-bit numbers plus two spare bytes, 50 bytes per triangle, and has no units: slicers assume millimetres, which is what this tool writes.
  • OBJ is a text format widely read by modelling software such as Blender. It stores each shared corner once and refers to it by number; like STL it has no units, and this tool writes millimetres.
  • 3MF is the 3D Manufacturing Format, a zipped XML package. Its core specification lets a file declare its unit; this tool writes millimetres explicitly, so the size is never misread. Modern slicers prefer it.

Bas-relief or lithophane?

The same mesh serves two very different objects. A bas-relief is a low, sculpted surface you look at from the front, lit from the side: coins and plaques are the classic examples. Use a depth map where near is high, a base of 2 mm or so, and a relief of a few millimetres to a centimetre; a side light brings the shape out.

For a plaque or a medal with a clean field around the subject, start one step earlier: the Background Remover cuts the subject out of the photo and passes it to Image to Depth Map, where the removed background stays flat instead of becoming bumps behind the figure.

A lithophane is a thin plate of translucent material whose thickness varies so that, lit from behind, thicker parts look darker and thinner parts brighter, and the picture appears. Here you should not use a depth map at all but the photo itself, read by brightness, with Invert ticked so dark areas become thick. Keep the base thin and the relief modest so light still passes through the thickest parts, and print in white or natural filament. The flat back sits on the print bed, which suits a flat lithophane panel.

When not to use it

This tool makes height fields: every point of the image gets one height, so it cannot make undercuts, overhangs or a full 3D figure. For a real 3D model of an object you need a CAD program, a sculpting tool or photogrammetry. It also does not add supports or hollow the part; slice it with the online STL slicer or your desktop slicer as usual.

For a crisp flat shape instead of a sculpted surface, such as a logo cut-out, a keychain or a sign with raised lettering, use Image to STL, which traces the outline of a two-tone image rather than reading every grey level as a height.

Frequently Asked Questions

Is my image or model uploaded?

No. The image is decoded in your browser, the mesh is built in a background worker on your device and the files are generated there. Nothing is sent to any server.

What input works best?

A 16-bit greyscale PNG depth map, such as the ones Image to Depth Map exports: its 65,536 levels give smooth slopes without steps. An 8-bit PNG or a JPG also works, but tall reliefs may show terraces because 256 levels spread over many millimetres become visible steps.

Why is my detail setting different in the summary?

The model is capped at one million triangles to keep it usable in slicers and in the browser. If your width and detail would exceed that, the spacing is increased in 10 % steps until the model fits, and the summary shows the effective detail actually used.

Is the STL watertight?

Yes. The top surface, the flat back and the walls share their edge points exactly, so every edge belongs to exactly two triangles and all normals point outward, both on a plate and when the background is not printed. You can confirm it with the STL printability checker on this site.

Why do the faces in my photo come out almost flat?

Because the distance between people uses up the height. Choose the Balanced or Faces / portrait preset: depth compression shrinks the big jumps and gives that height to each subject's own shape. It only uses the estimated depth, so a small face that the depth model saw as nearly flat stays nearly flat; crop closer or print larger.

Which way up does it print?

Flat back down. The back is a flat plane at zero height, so it sits on the print bed with no supports, and the relief rises from it.

How do I make a lithophane?

Use the photo itself instead of a depth map, tick Invert so darker areas become thicker, keep the base thin and the relief modest so light passes through, and print in white or natural filament. Then light it from behind.

STL, OBJ or 3MF: which should I download?

STL if in doubt: every slicer reads it. 3MF if your slicer supports it, because it records that the units are millimetres. OBJ if you want to edit the relief in modelling software such as Blender.

Can it make a full 3D model from a photo?

No. It builds a relief: one height for each point of the image, on a flat back. It cannot create undercuts or the back of an object. For a full 3D model you need modelling software or photogrammetry from many photos.

What does the frame do?

It adds a raised border around the relief, with the width and height you choose, as part of the same watertight surface. Use it for a plaque rim or a picture-frame edge.

Learn more