16

When I process a raster in QGIS it creates a second band. It appears that the band has no useful data. I like to use the Raster Colours Tool and it will not accept a raster with anything more than one band.

How do I remove the extra band?

2
  • 1
    What raster processing are you doing that creates the extra band? It sounds like it is generating a mask band. Commented Apr 25, 2011 at 13:37
  • I am using the new clipper tool in QGIS 1.7. It is a GDAL_TRANSLATE implementation as far as I know. I use a shapefile mask layer and a no data value of 0.
    – BWill
    Commented Apr 25, 2011 at 14:46

4 Answers 4

9

select in Toolbox: Rearrange bands. And remove band

3
  • By far the easiest option! Especially if you just want to drop just one band from a multi-band raster.
    – EcologyTom
    Commented Jun 23, 2021 at 14:41
  • Well, I select one band (the one to keep) and after processing, the other bands are still in the new product. Commented Apr 10, 2023 at 11:53
  • Maybe you have some specific raster that the algorithm cannot process, try resaving it to another format, I just tried the PNG 4 bands file, everything is fine, only the selected band remains... Commented Apr 10, 2023 at 20:47
8

Interesting. If you specify a shapefile as a mask, it uses gdal_warp, and automatically adds -dstalpha to the commandline options.

For now, you could copy the text that appears at the bottom of the dialog box, and paste it into a command line window, removing the -dstalpha option. But this isn't an ideal solution, so I suggest you file a ticket on the QGIS bug tracker to get it added as an option.

As an alternative but sticking with the command line, you could run gdal_translate on your two-band file, using the option -b 1 to just use the first band for the output.

Band control is definitely something worth having in QGIS I reckon, so it might be worth adding that to the bug tracker as a requested feature.

0

Try "GDAL miscellaneous raster calculator". I had the same problem. In the dialog box choose the raster file for the A band, and leave the other band as not selected. In the calculation gdalnumeric command text box type A*1. The raster file created will have only one band.

0

You can just use QGIS raster calculator:

Expression: "my_raster@1"

Click current layer extent

and save as a new single band raster.

Your Answer

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

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