I'm importing grayscale elevation images (bmp and jpeg) into a program I use for 3d CNC terrain carving. I've been downloading Hi-Res terrain corrected DEM files from ALOS PALSAR. I bring them into ER Viewer and export them as bmp files.

When I extrude the bmp the terrain is stepped, which onscreen grayscale looks smooth and does not indicate.

What am I doing wrong here. It must be something I don't understand about raster files and the way they behave. I just want to have raster files that are smooth and not stepping. I'm calling it stepping as its not exactly like contour lines but it will be noticable when I come to carve these.


This is likely a difference in bit depth. Whatever format the DEMs are provided in probably stores each pixel as a 32 or 64 bit float. These can store values out to a handful of decimal places and therefore represent a height change between neighboring pixels in a fraction of a unit. The GDAL docs suggest that the BMP format can only store 8 bits per color channel. This would limit the pixel values to whole numbers from 0-255, basically cutting off the decimal precision entirely. The difference between neighboring pixels can no longer be less than one unit (a meter?), and so you get that stair-step effect.

Check what other formats your CNC software can handle. TIFF is a common one that can handle higher-precision data types.

  • Thats very helpful. Tried tif and jpeg and both much better – carl Nov 9 '18 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.