[GIS] Convert 32 bit image to 8 bit image in QGIS

classificationconvertqgisraster

I want to convert my images from 32 bits to 8 bits. I'm using otb to calculate texture and the raster output is on 8 bits, I'm going to use this information as a layer stack for my multispectral image at 32 bits!

How to convert from 8 bits to 32 bits, if it possible in QGIS?

Best Answer

At the start of your question you ask about going from 32 bit to 8 bit and at the end you ask about going the other way, so this will be a generic answer.

Most of the GDAL functions allow you to specify the pixel depth with the commandline tag -ot (for instance see the documentation on gdal_translate or gdal_rasterize). The -ot switch can take the values Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/ CInt16/CInt32/CFloat32/CFloat64.

In QGIS, if you want to force the output from a GDAL function to give you a specific pixel depth rather than a default, then edit the commandline to include the -ot switch with whatever pixel depth you want. For instance go Raster->Conversion->Translate. At the bottom of the dialog box (at least in version 1.9) you will see the commandline command generated for you. Click the button next to it with little pencil icon to allow you to edit the commandline and add your -ot switch.

Example using gdal_translate in QGIS, converting from floating point 32 bit to 16 bit unsigned integer: enter image description here

Related Question