0

I have sentinel 2 images. Each image has 13 bands (bands are not individual images). I wanted to convert them to only RGB images and store them in a file to use for another purpose.

I have tried

raster - Conversion - PCT to RGB

But it does not work. this is the error:

 File "/usr/bin/pct2rgb.py", line 121, in 

 ct_size = ct.GetCount()

 AttributeError: 'NoneType' object has no attribute 'GetCount'

is there a fix to this or any other methods to achieve converting multiband to rgb.

1

You really can't convert 13 band image into RGB but you can select 3 bands out of 13 and save them as RGB. I would do that with gdal_translate https://www.gdal.org/gdal_translate.html.

Example that select bands 1, 10, and 13:

gdal_translate -of GTiff -b 1 -b 10 -b 13 input_sentinel_13_band.tif output_RGB.tif

Be aware that this as-simple-as-possible command yields a TIFF file that is most probably not optimal for QGIS. There are bunch of options for formatting TIFFs in https://www.gdal.org/frmt_gtiff.html. Learning what they all mean will take some time but is certainly worth the trouble.

  • Thanks. it works well. I was actually going to use gdal translate to use converting it to jpg but subselecting bands and doing the conversion saves a lot of work. – MKJ Aug 9 '18 at 10:49

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.