This little command line gem was made of dirt and ugly code. 'All' it does is (try to) convert raw (.raw, .hgt, .bin etc) terrain files to an image file, and vice versa. This makes a workflow where you want to edit a terrain file with multiple tools (image editors, terrain editors) more convenient. Also, it allows easy 2-way conversion in cases where no other/free/simple tool is available. Last not least, it supports 16-bit image depths reducing or nihilating information loss on conversion.


  • Convert raw heightmap files of various formats to grey scale image
  • Convert image files of various formats to raw terrain files
  • Support for 8 and 16 bit input
  • Support for 16-bit image format when available (typically: targa)
  • Interactive mode and automatic mode
  • Auto-detect or suggest size on raw input files
  • Auto-detect motorola or intel byte ordering (or manual)
  • Compatible with virtually any terrain tool that uses raw terrain files.
  • Support for importing Second Life raw terrain files (13-channel)
  • Command line. 'Runs everywhere'. Drag-and-drop.
  • 'Just works'
  • Limitations

  • On converting images to terrain, a grey map is assumed and only RED channel is read.
  • Interactive mode only available when no filename was given on the command line. If filename was given, automatic mode is assumed.
  • Sorry for the messy and bad-structured source. However it's reasonable short for a tool that has so much features. Feel free to play around. Send me update if you improved it please.
  • Input directory is equal to output directory
  • Output file names are based on input file with new extension added (so, 'myimage.jpg' will become 'myimage.jpg.raw', and 'myterrain.hgt' will become 'myterrain.hgt.tga', possibly overwriting existing (typically: previous converted) files.
  • Usage

    Extract the zip file, for convenience you could make a shortcut to the executable. Drag'n'drop an image or terrain file on the binary or shortcut. Automatic conversion should take place. The output file is created in the same folder as your input file.
    For interactive mode, just start the executable (without parameters). First it will ask is an input filename. Drag and drop an input file to the console window. The conversion will start, and at relevant points questions will be asked allowing to change parameters.


    Binary: win32 (zip)
    Source (FreePascal) View Download


    This code is released under BSD license. As in: do as you please, hope it's of help. You are free to re-license this code as GPL provided you clean it up a bit as i cba.


    Requirement: FreePascal compiler. This code is not compatible with other compilers (borland, gnu pascal) due to absence of libraries.
    Assuming you run a platform where freepascal runs, you should have no problem compiling this source. If a graphic library isn't supported, you might want to comment it out.
    To compile, download the source, save it as pascal file (.pp, .pas or .lpr for example) - it's only a single file-, and use either lazarus or fpc to build.

    Compatible Software

    The following were tested. This tool is considered to be compatible with about anything that supports raw 16-bit terrain files, so this list is any but exclusive.
  • The Gimp* (*16 bit preservation dependant on gimp filters and actions))
  • Unity 3D
  • Second Life* (*Import)
  • Terragen
  • Various terrain tools


    This tool was made due to the sheer abondance of any simple just-convert tool. I realized most of the conversion was reasonable straightforward. By now, i spent more time on creating a website for it than writing the tool itself it seems. Yet, it does what i wanted it to do and i figured it'd be nice to share.