I have rasters in 1 band 64bits float that represent real data values and for which I can set min and max using the stretch to min and max option in QGIS.

I would like to convert these rasters to RGB 8 bits with a greyscale and with the min and max that I have set.

It is easy to do in ArcGIS as it can be seen in this other subject:

Is there a way to programatically force RGB (3 bands) in a raster with arcpy?

I am looking for a way to do the same thing in QGIS. I do not need a script, I just need to be able to do the conversion.

Does anyone know a way to dot it in QGIS?

Thank you very much. I have found this plugin and tried to install it. I edited my first post but when I finished, it gave me a message saying the edit had to be reviewed and it has not been updated yet. I am having an error message when I try to execute the plugin related to the Python code

    An error has occured while executing Python code:

Traceback (most recent call last):
  File "C:/Users/user/.qgis//python/plugins\bccAddRColor\bccAddRColor.py", line 140, in DoWork
    cplArray, nod )
  File "C:/Users/user/.qgis//python/plugins\bccAddRColor\qml2gdal.py", line 599, in rasterOPal
    tif_ds.GetRasterBand(1).SetRasterColorTable( ct )
AttributeError: 'NoneType' object has no attribute 'GetRasterBand'

Python version:
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS version:
1.8.0-Lisboa Lisboa, 6416f38

Python path: ['C:\\Users\\user\\.qgis\\python\\plugins\\GeoCoding', 'C:\\Users\\user\\.qgis\\python\\plugins\\GeoCoding', 'C:/OSGeo4W/apps/qgis/./python', 'C:/Users/user/.qgis//python', 'C:/Users/user/.qgis//python/plugins', 'C:/OSGeo4W/apps/qgis/./python/plugins', 'C:\\Windows\\system32\\python27.zip', 'C:\\OSGeo4W\\apps\\Python27\\DLLs', 'C:\\OSGeo4W\\apps\\Python27\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\plat-win', 'C:\\OSGeo4W\\apps\\Python27\\lib\\lib-tk', 'C:\\OSGeo4W\\apps\\qgis\\bin', 'C:\\OSGeo4W\\apps\\Python27', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\Users\\user\\.qgis\\python\\plugins\\mmqgis/forms', '/usr/share/qgis/python', 'C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\fTools\\tools',

I have tried to reinstall it and I checked the repository but there is no change. I documented the problem sending it to the user-list specified on the plugin's webpage and I am waiting for the answer.


You can do this by installing a plugin called "Convert 1-band raster to a paletted raster or RGB raster". It is not in the main QGIS repository, so download and installed it from


First you will have to create a styled raster and save the QML file. The same folks have a handy plugin called "1-band raster colour table" that has many built-in styles including grayscale. Apply that, save the style as a QML file and use the plugin to convert to RGB.

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.