9

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?

8

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.

  • 2
    I would add that the -ot switch does not scale the values on transformation. To do that, use -scale or -scale_1, -scale_2, ... per band. – Logan Byers Dec 2 '16 at 13:20
  • "Pixel depth" is a term ESRI appears to have made up out of nowhere, by the way. – jpmc26 Apr 24 '18 at 23:44
  • Pixel depth is actually a term that is widely used in conjunction with raster image files and is far from exclusive to ESRI or indeed GIS. – MappaGnosis Apr 26 '18 at 9:15

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.