At 10.8.1, I have an 32-bit, unsigned, integer TIFF raster. The NoData value is, as expected, 4,294,967,295 (2^32-1).

The values in this raster range from only 0-7, which makes a 32-bit depth overkill. I thus decided to use the Copy Raster tool to reduce the bit depth, using Pixel Type = 4-bit. The tool help states that the output will be an "...unsigned integer. The values supported can be from 0 to 15."

However, the tool's default output NoData Value is -1. Sure enough, when using this default setting, the output is an unsigned 4-bit TIFF, where the NoData value = -1.

As far as I know, unsigned rasters can only contain positive values. Since my output TIFF is unsigned, I would thus expect its NoData value to also be a positive integer, just as in the source 32-bit unsigned integer TIFF.

How can an unsigned integer TIFF contain a negative NoData value?

I'm asking this question in order to better understand raster technology in general. I'm not asking how to "force" a postive NoData output value, which could be done by selecting a positive value in the Copy Raster tool, or by using the Raster Calculator, as commented by MoreMeowBell.

  • Are you trying to solve the issue? If so Raster Calculator is a great way to go about it. Jan 29, 2022 at 20:22
  • 4-bit TIFF is rather uncommon. I have a feeling that it is physically stored as 8-bit. But if it is logically limited to 0-16 range then -1 values do feel wrong.
    – user30184
    Jan 29, 2022 at 21:12
  • 1
    @user30184 raster is output as a Byte dataset, but actual data is definitely stored as 4bit, can check by looking at file sizes of uncompressed rasters e.g using rasterio to write a 1-bit dataset gis.stackexchange.com/a/338424/2856 (note ArcGIS uses GDAL to write GeoTIFFs and uses the NBITS=N creation option)
    – user2856
    Jan 30, 2022 at 0:37
  • The kind responses so far got me to wondering what QGIS would report about this 4-bit tif in Layer Properties. The result: Data Type is "Byte - Eight bit unsigned integer" and No-Data is "n/a".
    – Stu Smith
    Jan 30, 2022 at 2:14
  • @user2856 mea culpa regarding your confusion. I rewrote my QGIS comment.
    – Stu Smith
    Jan 30, 2022 at 2:15

1 Answer 1


Your 4bit TIFF can't store values outside the range 0-15. Just like an 8bit unsigned (Byte) raster can not store values outside of 0-255.

The NoData value is only metadata, it's just for telling ArcGIS or other software to ignore a specific value. You can specify a NoData value that is outside the valid range of the datatype e.g. -1 in this case or -9999 if you like, but ArcGIS won't actually write -1 values to the output raster. Where there is NoData in the input raster, they will be output as 0.

I suggest it's a bug that ArcGIS allows specifying a NoData value outside the range of the output datatype and then silently writing a different value to the output raster (the minimum value of the output datatype range). The GDAL library that ArcGIS uses to write many raster formats also does this.

Input (NoData shown in black)


Output of Copy Raster 4bit with NoData = -1


gdalinfo test_4bit.tif
Driver: GTiff/GeoTIFF
Band 1 ... Type=Byte, ...
  NoData Value=-1
  Image Structure Metadata:

As you have noticed, QGIS ignores the NoData value as it's outside the valid range of the datatype:

enter image description here

  • Your screenshots are interesting, and I want to make sure that I understand what they mean. Specifically, the black (NoData) input cells are displayed as pink in the 4-bit output. What happened to those NoData cells? Are they still NoData, or converted to some other value, or...?
    – Stu Smith
    Aug 2, 2022 at 18:59
  • 1
    "Where there is NoData in the input raster, they will be output as 0." means any NoData values will be converted to 0.
    – user2856
    Aug 2, 2022 at 22:09

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.