I'm new to QGIS. I have some bathymetric data of Australia I'm trying to output as a high bit depth Tiff, however it's not coming out the way I want.

In QGIS I have set the singleband grey to a custom min max so I have the contrast I want. However when using Raster > Converstion > Translate (Convert Format), it seems to ignore my custom min max values and output using the default.

How can I export to 16 bit Tiff using my custom min max values?

I saw someone post about Gdal tools but I'm not sure how I would use them.

enter image description here

  • 1
    Is your goal to have a TIF for vizualization purpose, just like a map, or do you want to continue your work on the file but with new values based on your thresholds? It seems you have been mixing 2 things: 1) the layer styling/rendering is just for vizual purpose if you want to export this view go to Project -> new print layout -> Export as Image and use these settings. 2) The Translate (convert format) tool changes the projection, the values of the file are not at all affected by this. Maybe something like the reclassify tool is what you were looking for to continue your analysis in the GIS?
    – Vincé
    Sep 28, 2022 at 11:07
  • I'll be taking the resulting image into a 3d program and using it to drive displacement values, so it's very important the image I get is at least 16bit or more. By changing the min max values it gets it into the range which is most useful for my purposes, if that makes sense.
    – Tom V
    Sep 28, 2022 at 11:46

2 Answers 2


I see. Then you actually really need to use the Translate tool as described here: Exporting a 16-bit image from QGIS.

But as I stated before in the comment, changing the layer-styling only affects how it is displayed it doesn't change the values itself. If you want to set a min/max value into which all other values that are lower/higher than you desired thresholds you can use the raster calculator. Or if you are not so familiar, use the Reclassify by Table Tool:

Click the "..." button next to the "Reclassification table" option

enter image description here

Click Add Row, change the table es like displayed below for your lower and upper thresholds (I chose arbitrary values).

And in the end dont forget to click OK otherwise your edit won't be saved enter image description here

What this does is: all values from -infinity to a maximum value of 350 --> reclassify to 350. This is your lower threshold.

All values from 400 to a value of +infinity --> reclassify to 400. This is your upper threshold.

enter image description here enter image description here

Please let me know if this was what you expected.

  • 1
    Sorry for the late reply. This worked for me, thanks!
    – Tom V
    Oct 12, 2022 at 5:15
  • nice. If you check this answer as correct. it won't show up as un-answered and may help others with a similar problem.
    – Vincé
    Oct 12, 2022 at 18:53

Use gdal_translate https://gdal.org/programs/gdal_translate.html with -ot Int16 for changing the datatype into 16 bit integer. Select other datatype from the list if you think that for example Float32 would be better. Option -scale is used for scaling https://gdal.org/programs/gdal_translate.html#cmdoption-gdal_translate-scale.

-scale [src_min src_max [dst_min dst_max]]

Rescale the input pixels values from the range src_min to src_max to the range dst_min to dst_max. If omitted the output range is 0 to 255. If omitted the input range is automatically computed from the source dataset, in its whole (not just the window of interest potentially specified with -srcwin or -projwin). This may be a slow operation on a large source dataset, and if using it multiple times for several gdal_translate invocation, it might be beneficial to call gdalinfo -stats {source_dataset} priorly to precompute statistics, for formats that support serializing statistics computations (GeoTIFF, VRT…) Note that the values specified after -scale are only used to compute a scale and offset to apply to the input raster values. In particular, src_min and src_max are not used to clip input values. -scale can be repeated several times (if specified only once, it also applies to all bands of the output dataset), so as to specify per band parameters. It is also possible to use the “-scale_bn” syntax where bn is a band number (e.g. “-scale_2” for the 2nd band of the output dataset) to specify the parameters of one or several specific bands.

If you want to stretch your custom Min and Max to full width of the Int16 range then your command would be

gdal_traslate -of GTiff -co tiled=YES -ot Int16 -scale [src_min] [src_max] input.tif output.tif

If you do not want to use the full range of the output datatype give your own values also for [dst_min] and [dst_max].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.