The basic principle is to take a regular 2D image (in BMP format) and translate the
image’s gray shades into a 3D height map (Figures 1 and 2). The two-dimensional
array (i.e. color) of each element is interpreted as a height value in order to store
information on the height of each point. For example; the white points are flat, the gray
points are higher and the black points are the highest.
The following steps in this procedure were accomplished using Microsoft®
Paint image viewing software and Materialise® Magics STL editing software,
and make reference to the menu options in those applications. Other similar
software programs may be used to accomplish this procedure.
Answered with a tutorial: https://grabcad.com/tutorials/how-to-convert-2d-bmp-images-to-3d-stls