#contour #heightmap #image #graphics #topography

bin+lib contours2heightmap

A CLI tool to convert contour line bitmap images into heightmaps

5 releases

Uses new Rust 2024

0.1.4 Nov 21, 2025
0.1.3 Aug 31, 2025
0.1.2 Aug 30, 2025
0.1.1 Aug 30, 2025
0.1.0 Aug 30, 2025

#552 in Images

MIT license

46KB
922 lines

contours2heightmap (c2h)

A simple CLI tool to convert contour line bitmap images into heightmaps.

Assumes a topographic interpretation where outer contours represent lower elevations and inner contours represent higher elevations.

Only supports simple images: all contours must be closed, non-overlapping, and with clear separation.

contour linear_greys linear_viridis linear_turbo flat_magma

Example

c2h --help
c2h input.png output.png --fill-mode linear --color-mode greys

Build from source

git clone https://github.com/Bowen951209/contours2heightmap.git
cd contours2heightmap
cargo build --release

Installation

Dependencies

~29MB
~572K SLoC