9

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

2
  • What is your QGIS version? Maybe 3.10?
    – KVO
    Jul 25, 2021 at 17:44
  • I have updated the question title, its 3.16.8
    – srinivas
    Jul 26, 2021 at 3:41

2 Answers 2

9

Use raster calculator - it has all the individual bands as inputs. Select the band you want as the only term in your expression and save it

3
  • Much easier, thank you for the trick @Jane
    – Meije3984
    Apr 17, 2022 at 9:02
  • Do you know how to "call" all of the bands, i have 2160?
    – Lusia
    Sep 8, 2022 at 15:17
  • 1
    In Raster Calculator, the items list in Raster Bands are individual whole rasters, each (potentially0 containing multiple bands. If one selects (double click) the raster they want, its full name is populated in quotes in the raster calculator expression. How does one select one or more bands from that specific raster (and have it output)? Thanks
    – dez93_2000
    Feb 14 at 1:02
8

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.

5
  • I tried to follow the steps you have mentioned however, I am not able to succeed. GDAL cell is not allowing me to place additional input i.e., '-b 1 or -b 1 -b 2' - I am not able to insert there in the cell. I am attaching the image of gdal console cell in the question description.
    – srinivas
    Jul 27, 2021 at 6:54
  • 1
    In your gdal console cell, there is a textbox to add additional command line parameters. Use it to add required parameters. Jul 27, 2021 at 7:34
  • Hi Srinivas, I have the same issue, not able to edit the GDAL console. Could you let me know how you solved it?
    – P.Kim
    Aug 18, 2021 at 4:15
  • See the previous comment. I Hope, it will help you. Aug 18, 2021 at 10:28
  • 2
    At 3.22.3, you cannot edit the text within the GDAL/OGR console call box. Instead, enter your additional input, such as -b 1 in the Additional command-line parameters [optional] box. Notice how this edits the GDAL/OGR console call
    – Stu Smith
    Feb 24, 2022 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.