= The `gdal_merge` utility = ''A python script to mosaic a set of images'' ''The official documentation for gdal_merge is at http://www.gdal.org/gdal_merge.html.'' gdal_merge.py uses nearest neighbour resampling. If you want control over the resampling used, you should use gdalwarp instead. == Are there other ways of getting a list of images into gdal_merge without putting them all on the command line? == Method 1, use `--optfile` flag to specify a text file of a directory listing of each file to merge. It can be created in Windows by typing: {{{ `dir /b /s *.tif > tiff_list.txtt` }}} or on unix by typing: {{{ ls -1 *.tif > tiff_list.txt }}} Then you summon gdal_merge like: {{{ python gdal_merge.py -n 0 -v -o mosaic_31.tif --optfile tiff_list.txt }}} Method 2, use a batch file wrapper, see attached. (for windows) == Create an RGB image by merging 3 different greyscale bands == Conduct "merging by stacking" with the -separate flag. So if you had three greyscale files that cover the same area and you do: {{{ gdal_merge.py -separate 1.tif 2.tif 3.tif -o rgb.tif }}} This maps 1.tif to red, 2.tif to green and 3.tif to blue. == Specify overlap precedence == The ''last'' image in the input line comes out on ''top'' of the finished image stack. You might also be need to note which color (value) is should not be copied into the destination image if it is not already defined as `nodata`. {{{ gdal_merge.py -o merge.tif -of GTiff -n 0 \ image1.tif image2.tif image3.tif image4.tif }}}