How can I split an 4 channel rgb pic in qgis? With the value tool I can see 4 channel. I tried to use the RGB to PCT tool but I always get an error (File "C:\PROGRA~1\QGISBR~1\bin\pct2rgb.py", line 125, in ct_size = ct.GetCount() AttributeError: 'NoneType' object has no attribute 'GetCount' )

  • Now I just have a tiff with one band, and want to render this image using pct2rgb.py, but it also alert the same problem. How should I fix it? many thx! – Yue LI May 24 '18 at 12:09

gdal_translate is able to extract single bands:

gdal_translate -b 1 in.tif out1.tif
gdal_translate -b 2 in.tif out2.tif
gdal_translate -b 3 in.tif out3.tif
gdal_translate -b 4 in.tif out4.tif

Raster -> Conversion -> Translate will create a gdal_translate command line, which you can edit to specify the band you want.

This also works with multiple -b flags:

gdal_translate -b 1 -b 2 -b 3 in.tif out.tif

This will produce an out.tif with three channels.

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.