[GIS] How to export only one band from an image using GDAL

gdalmulti-band

I have a multi-band GeoTiff, and I want to extract only the first band and write a new image consisting of only that band.

How do I do this using GDAL?

Best Answer

The Gdal_translate utility can be used.

The documentation mentions:

...to convert raster data between different formats, potentially performing some operations like subsettings, resampling, and rescaling pixels in the process.

It also has an option for bands, where you selects which bands you want to operate on.

So if you want to export just the first band, you can use the following command:

gdal_translate -b 1 input.tif output.tif