gdal_translate -ot Byte -co NBITS=1 "0_1_raster.tif" "binary_raster.tif"
Here is what the above code is Doing:
1. gdal_translate is the command to translate a raster file from one format to another.
2. -ot Byte is the command to set the output file type to Byte.
3. -co NBITS=1 is the command to set the number of bits to 1.
4. “0_1_raster.tif” is the input file.
5. “binary_raster.tif” is the output file.