Skip to main content
added 12 characters in body
Source Link
BradHards
  • 12.9k
  • 2
  • 39
  • 72

I start with a bunch of 1-bit geotiff files that I had to convert to 8-bit RGB tiff files to use with GdalGDAL. Then I tried to set borders to red (content is in black and white so I can't use those) and do

gdal_translate -a_nodata '200 0 0' -of vrt red.tiff nodata.vrt

gdalbuildvrt -srcnodata '200 0 0' -vrtnodata '200 0 0' -hidenodata -addalpha nodata.vrt trans.vrt

gdal2tiles.py -a "200,0,0" trans.vrt ...

gdal_translate -a_nodata '200 0 0' -of vrt red.tiff nodata.vrt

gdalbuildvrt -srcnodata '200 0 0' -vrtnodata '200 0 0' -hidenodata -addalpha nodata.vrt trans.vrt

gdal2tiles.py -a "200,0,0" trans.vrt ...

But I am only able to hide nodata if it is in grayscale(ex. rgb(200,200,200)) I think the color information is just lost in the gdal_translate process. Is there any way to verify what happened and make gdal work with nodata that has custom colors?

I start with a bunch of 1-bit geotiff files that I had to convert to 8-bit RGB tiff files to use with Gdal. Then I tried to set borders to red (content is in black and white so I can't use those) and do

gdal_translate -a_nodata '200 0 0' -of vrt red.tiff nodata.vrt

gdalbuildvrt -srcnodata '200 0 0' -vrtnodata '200 0 0' -hidenodata -addalpha nodata.vrt trans.vrt

gdal2tiles.py -a "200,0,0" trans.vrt ...

But I am only able to hide nodata if it is in grayscale(ex. rgb(200,200,200)) I think the color information is just lost in the gdal_translate process. Is there any way to verify what happened and make gdal work with nodata that has custom colors?

I start with a bunch of 1-bit geotiff files that I had to convert to 8-bit RGB tiff files to use with GDAL. Then I tried to set borders to red (content is in black and white so I can't use those) and do

gdal_translate -a_nodata '200 0 0' -of vrt red.tiff nodata.vrt

gdalbuildvrt -srcnodata '200 0 0' -vrtnodata '200 0 0' -hidenodata -addalpha nodata.vrt trans.vrt

gdal2tiles.py -a "200,0,0" trans.vrt ...

But I am only able to hide nodata if it is in grayscale(ex. rgb(200,200,200)) I think the color information is just lost in the gdal_translate process. Is there any way to verify what happened and make gdal work with nodata that has custom colors?

Source Link
ttback
  • 111
  • 2

How do I set nodata with custom color for gdal_translate and gdal2tilespy?

I start with a bunch of 1-bit geotiff files that I had to convert to 8-bit RGB tiff files to use with Gdal. Then I tried to set borders to red (content is in black and white so I can't use those) and do

gdal_translate -a_nodata '200 0 0' -of vrt red.tiff nodata.vrt

gdalbuildvrt -srcnodata '200 0 0' -vrtnodata '200 0 0' -hidenodata -addalpha nodata.vrt trans.vrt

gdal2tiles.py -a "200,0,0" trans.vrt ...

But I am only able to hide nodata if it is in grayscale(ex. rgb(200,200,200)) I think the color information is just lost in the gdal_translate process. Is there any way to verify what happened and make gdal work with nodata that has custom colors?