[GIS] Exporting single band from multiband raster in QGIS

banddata managementqgisqgis-3raster

In QGIS 3.16.8 I have a raster image in TIFF format which has 17 bands. I need to extract different band combinations as separate image files. Some of the combinations consist of images with single band only.

Is there a way in QGIS, where we can export a single band or combination of multiple bands as a image.

The gdal command cell input where I tried to translate raster layer and get the output is not working for me. I have attached the image for your reference.enter image description here

Best Answer

Here is a trick to solve your problem.

From the top menu, go to Raster>Conversion>Translate.

Then, in the Translate window, perform the following tasks:

  1. Select your input layer.
  2. Select the output path and write an output file name.
  3. Choose target SRS (desired output coordinate reference system).
  4. After performing the above steps, you will see the command at the bottom (inside a text box).
  5. Edit this command, and add "-b 1" at the end if you want to extract the first band from the input image. Add "-b 2" if you want to extract the second band, and so on.

For example (To extract the first band):

gdal_translate -of GTiff "path of input image" "path of output image" -b 1

For example (To extract the first two bands):

gdal_translate -of GTiff "path of input image" "path of output image" -b 1 -b 2

In this way, you can extract different bands and their combinations from an input image.

For more description, visit the documentation.

Related Question