9

Is there a tool that is able to transform a multi-band image to single band rasters? I usually use the raster calculator within the modeler to do that.

2 Answers 2

16

You could use gdal_translate from the new workflow, which is under:

Raster > Conversion > Rearrange bands... 

You won't be able to select the pencil as in the past, but you can select only the band you need from the UI. You also get the python code in case you want to use it in pyqgis:

gdal_translate "path/to/raster.tif" -b 1 "path/to/result.tif"

To get band 2, replace -b 1 with -b 2 etc.


Note: you may need to enable the GdalTools plugin.

7
  • 1
    If you use VRT as the outputformat you will get something like the first example in gdal.org/gdal_vrttut.html. Then you need just edit the <SourceBand>1</SourceBand> line for selecting other bands.
    – user30184
    Commented Apr 18, 2017 at 20:33
  • @Pimpel - Most welcome! Glad it worked :)
    – Joseph
    Commented Apr 20, 2017 at 12:18
  • 2
    Is it me or did they remove the pencil icon in Qgis > 3.4 ?
    – Kantan
    Commented Jan 16, 2019 at 7:46
  • 1
    @Kantan - It's not you, this has been an issue which has been reported: https://issues.qgis.org/issues/15090
    – Joseph
    Commented Jan 16, 2019 at 10:46
  • 1
    Thanks @Joseph! Unfortunately, it was rejected, so I guess only the raster calculator trick works now.
    – Kantan
    Commented Jan 16, 2019 at 11:55
0

Using GDal Translate in QGIS (Raster --> Conversion --> Translate) just add -b 1, then -b 2, etc in the Additional command-line parameters.

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.