GDAL_MERGE(1)
π GDAL_MERGE(1) β the mosaic-maker π
okay so this is the page from the GDAL manual (yep, that GDAL) and it's literally about gdal_merge β the little utility that stitches a bunch of images together into one big gorgeous mosaic. bestie, let's get into it π¦
β¨ NAME β¨
gdal_merge β mosaics a set of images π§©
πΈ SYNOPSIS πΈ
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
π DESCRIPTION π
So this utility will, like, automatically mosaic a set of images for you. no manual stitching, no tears π
the rules tho, listen:
- all the images have to be in the same coordinate system</> β no mixing, periodt
- they need a matching number of bands</> β like, they gotta match or it's not happening
- but it's totally fine if they're overlapping, and it's fine if they're at different resolutions. we love flexibility β¨
and in areas of overlap? the last image will be copied over earlier ones. that's the vibe. last one in wins π
π OPTIONS π
-o<out_filename>β the name of the output file, which gets created if it doesn't already exist. and if you don't say anything? it defaults toout.tifπ«Ά-of<format>β pick the output format. starting with GDAL 2.3, if you don't specify it, the format is guessed from the extension (before that it wasGTiff). use the short format name, bestie π-co<NAME=VALUE>β sooo many formats have one or more optional creation options that control the particulars of the file being created. for instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled. cute, right?
the creation options available vary by format driver, and some simple formats have no creation options at all. a list of options supported for a format can be listed with the --formats command line option β but the documentation for the format is the definitive source of truth on driver creation options. see the raster_drivers format specific documentation for the legal creation options for each format π
-ot<type>β force the output image bands to have a specific data type supported by the driver. one of these icons only:Byte,UInt16,Int16,UInt32,Int32,Float32,Float64,CInt16,CInt32,CFloat32orCFloat64π-ps<pixelsize_x><pixelsize_y>β the pixel size to be used for the output file. if you don't specify it, the resolution of the first input file gets used π-tapβ (target aligned pixels) aligns the coordinates of the extent of the output file to the values of the-tr, such that the aligned extent includes the minimum extent β¨-ul_lr<ulx><uly><lrx><lry>β the extents of the output file. if you don't specify, the aggregate extents of all input files will be used π-vβ generate verbose output of the mosaicing operations as they're being done. very "tell me everything" energy π£οΈ-separateβ place each input file into a separate band ποΈ-pctβ 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 π¨-n<nodata_value>β ignore pixels from files being merged in that have this pixel value. bye felicia π-a_nodata<output_nodata_value>β assign a specified nodata value to output bands π³οΈ-init<"value(s)">β pre-initialize the output image bands with these values. however, it's not marked as the nodata value in the output file β important distinction, don't get it twisted π if only one value is given, that same value is used in all the bands π-createonlyβ 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. no python, no merge, no cap.
π₯ EXAMPLE π₯
create an image with the pixels in all bands initialized to 255. iconic.
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. the way that works >>> π¦
gdal_merge.py -init "0 0 255" -o out.tif in1.tif in2.tif
π AUTHOR π
Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de> π«Ά
π COPYRIGHT π
1998-2026
and that's the whole page, bestie π so anyway β this shipped with GDAL, dated Jan 08, 2026, and the copyright sits at 1998-2026. go make some mosaics, you're gonna slay β¨π πΈ
π¦ where this page comes from
- epel 9: gdal3.4-python-tools 3.4.3-5.el9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms