1

How can I extract a single band from multi-band raster in QGIS?

I have an remote sensed image which has 6 bands (including NDVI band), I want to display each band separately, but have no idea how to do. I have seen some questions similar here but none worked for me.

The original image (has 6 bands) is: enter image description here

I want to display the band 6 which should be like this: enter image description here

But I tried gdal_translate, and couldn't get the correct result.

What I have got is: enter image description here

  • Thanks for answering but when I used gdal_translate, qgis showed that 'Error 4: Kayena.tif: No such file or directory". Would you know how to fix it? – Summer Mar 4 at 7:12
  • Can you show your gdal command please?? And what OS you're using or can you give any usefull info?? – George Boldeanu Mar 4 at 7:16
  • Use the full path to Kayena.tif and your output raster, it's saying it can't find the file in the one place it's looking for it so it mustn't be there; what your default path and full path is depends on your environment and OS but you can implicitly specify the full path to avoid confusing the tool. – Michael Stimson Mar 4 at 7:58
  • Please take some time to clarify what you need. do you want the images side by side or on top of each others ? This would be completely different issue than your original question. If you can display one band, this is what you asked for. Then try to solve you second question (asking a new question if necessary). – radouxju Mar 4 at 9:38
2

This is a display issue: you want to display a continuous band using categories. You do not need to split your image to create a new new image: this can be done directly on the multiple band image, and you can add the multiple band layer multiple times on the map.

Go to layer properties > Symbology

Select singleband pseudocolor

Choose the band that you want to display

Select a color ramp

Select an interpolation method (discrete is OK)

Select a mode (I suggest quantile)

Select a number of classes

If you want to change some colors, double clic on the color. And if you want to change a threshol value, double clic on the threshold value.

enter image description here

As a remark, your band 6 doesn't look like the NDVI that you could derive from your image. It is more like some interpolated soil properties (or smoothed NDVI, but if you have a NIR band you could have a more precise one.)

EDIT: I now see from one of your comments that you don't use QGIS 3. In QGIS 2, this would be similar except that you must select "style" in the layer properties.

  • Thanks for your answer. However, I tried this displaying approach before, it didn't show the image that it was supposed to. The expected result is that each band is displayed separately. As I added in question just now. I suspect that there is another way to do it. – Summer Mar 4 at 8:48
  • you need to add the 6 band image 6 times as a layer, and then for each layer you select a different band to display. – radouxju Mar 4 at 9:25
  • Thank you redouxju, it has been solved using your method. At first I couldn't get the correct result because of I didn't remove the nodata value. – Summer Mar 5 at 0:52
  • 1
    @Summer if this answer solved your issue - gis.stackexchange.com/help/someone-answers – user2856 Mar 5 at 2:43
2

You can use Rearrange bands tool from processing toolbox but select one band at a time and save the output as separate file:

enter image description here

Now the selected is only one band, and save the image as a new file:

enter image description here

The tool exists in Processing toolbox -> GDAL -> Raster Conversion -> Rearrange bands in QGIS 3.4.5 for the above tool.

Input 6 bands:

enter image description here

Output 1 band:

enter image description here

Repeat to select the bands you want or Run in Batch mode at the bottom of the tool.

  • Thank you this looks good, unfortunately I couldnt update my QGIS as there is a plugin requiring the version below 2.3 – Summer Mar 4 at 7:49
0

NDVI image with 6 bands?? It's not clear what you are asking. NDVI should be a single band raster, with values between -1.0 to 1.0. You might have a colored image with different values of NDVI, but it would then be 3 bands (RGB) not 6. And separating out one of the colors would not be useful in my opinion...

If you are trying to separate out the NDVI values above a certain threshold, then you could use the QGIS raster calculator with an expression like: ("ndvi" > 0.25) * "ndvi"

See here for the relevant QGIS documentation

  • Sorry my mistake. It is not NDVI with 6 bands, but a remote sensed image that has 6 bands, including an NDVI band. I want to display the NDVI band, but somehow I couldn't. I just used the gdal_translate but the resulting image is not right. – Summer Mar 4 at 7:41
  • I just put pics to the question. would you know how to get the NDVI band? Thanks! – Summer Mar 4 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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