[GIS] Using gdal_merge to create a grayscale mosaic

ecwgdalgeotiff-tiffmosaic

My gdal fu is weak and I need help! 😉

I'm creating a mosaic in geotiff from hundreds of ecw. I created a list of all my rasters and used this command:

gdal_merge -o c:\temp\output_image.tif -q -v --optfile c:\temp\rasterlist.txt

It's working, but I'd like now to create one with only the red band. Is it possible to do it with gdal_merge?

Thanks!

Best Answer

The simplest way I can think of is to take the merged raster you have just made and save out the red band (perhaps using gdal_translate and the -b switch). Alternatively you could use QGIS' raster calculator to save only the red band as a new raster.