Is it possible to reduce a raster to hold just 1 or 0 values with gdal? I find no data formats less than "Byte" in the documention

1 Answer 1


GeoTIFF with NBITS=1 is binary even the datatype is Byte https://gdal.org/drivers/raster/gtiff.html. I do not know the internal structure of such TIFF but together with the CCITT Group 4 compression that is designed long time ago for fax machines it yields very small file size.


gdal_translate -of GTiff -co NBITS=1 -co compress=CCITTFAX4 input.tif output.tif
  • I recommend NOT blindly using that compression. For a random 1 bit noise image I made it did increase the file size by double compared to just using NBITS=1 alone. Sep 7 at 17:37
  • 1
    Add -ot Byte to avoid errors: NBITS is not supported for data type Int32 and Fax3SetupState:Bits/sample must be 1 for Group 3/4 encoding/decoding Oct 18 at 13:17

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.