DOKK / manpages / debian 10 / python-gdal / gdal_merge.1.en
gdal_merge(1) General Commands Manual gdal_merge(1)

gdal_merge - Mosaics a set of images.

gdal_merge.py [-o out_filename] [-of out_format] [-co NAME=VALUE]*

[-ps pixelsize_x pixelsize_y] [-tap] [-separate] [-q] [-v] [-pct]
[-ul_lr ulx uly lrx lry] [-init "value [value...]"]
[-n nodata_value] [-a_nodata output_nodata_value]
[-ot datatype] [-createonly] input_files

This utility will automatically mosaic a set of images. All the images must be in the same coordinate system and have a matching number of bands, but they may be overlapping, and at different resolutions. In areas of overlap, the last image will be copied over earlier ones.

The name of the output file, which will be created if it does not already exist (defaults to 'out.tif').
Select the output format. Starting with GDAL 2.3, if not specified, the format is guessed from the extension (previously was GTiff). Use the short format name.
Creation option for output file. Multiple options can be specified. See format specific documentation for legal creation options for each format
Force the output image bands to have a specific type. Use type names (i.e. Byte, Int16,...)
Pixel size to be used for the output file. If not specified the resolution of the first input file will be used.
(GDAL >= 1.8.0) (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent.
The extents of the output file. If not specified the aggregate extents of all input files will be used.
Generate verbose output of mosaicing operations as they are done.
Place each input file into a separate band.
Grab a pseudo-color table from the first input image, and use it for the output. Merging pseudo-colored images this way assumes that all input files use the same color table.
Ignore pixels from files being merged in with this pixel value.
(GDAL >= 1.9.0) Assign a specified nodata value to output bands.
Pre-initialize the output image bands with these values. However, it is not marked as the nodata value in the output file. If only one value is given, the same value is used in all the bands.
The output file is created (and potentially pre-initialized) but no input image data is copied into it.

NOTE: gdal_merge.py is a Python script, and will only work if GDAL was built with Python support.

Create an image with the pixels in all bands initialized to 255.

% gdal_merge.py -init 255 -o out.tif in1.tif in2.tif

Create an RGB image that shows blue in pixels with no data. The first two bands will be initialized to 0 and the third band will be initialized to 255.

% gdal_merge.py -init "0 0 255" -o out.tif in1.tif in2.tif

Frank Warmerdam warmerdam@pobox.com, Silke Reimer silke@intevation.de

Sun Jan 13 2019 GDAL