Using GDAL to merge 3 bands to form a multispectral image?

Per user30184's comment, you can use gdal_merge like so:

gdal_merge.py -separate  -o new_rgb.tif -co PHOTOMETRIC=MINISBLACK C:\input_r.tif C:\input_g.tif C:\input_b.tif

I had MemoryError with gdal_merge.py -separate ... when used on big input. Different answer helped my issue:

gdalbuildvrt -separate RGB.vrt red.tif green.tif blue.tif
gdal_translate RGB.vrt RGB.tif

Tags:

Gdal