Hi Nick,
I'm trying to create 1-bit mask files by gdal_translate. The command is as follows:
gdal_translate -b 1 -co nbits=1 -of gtiff -co 'COMPRESS=DEFLATE' -co 'TILED=YES' -co 'BLOCKXSIZE=256' -co 'BLOCKYSIZE=256' in.tif bit.ptiff
The last few lines of gdalinfo of this bit.ptiff are as follows:
Band 1 Block=256x256 Type=Byte, ColorInterp=Palette
Image Structure Metadata:
NBITS=1
Color Table (RGB with 2 entries)
0: 0,0,0,255
1: 255,255,255,255
new_dataset = rasterio.open('out.ptiff', 'w',
driver='GTiff',
compress="DEFLATE",
tiled=True, blockxsize=256, blockysize=256,
height=data.height, width=data.width,
count=1, dtype='uint8', nbits=1,
crs=data.crs, transform=data.transform)
The gdalinfo of out.ptiff by rasterio is similar as the gdalinfo of bit.ptiff by gdal_translate.
I'd like to know if these ptiffs created by these methods are correct 1-bit mask files.
These ptiffs are in the attached zipfile.
Look forward to your reply.
Thank you.
Xiao