How do I change geotiff "no data" color to white/transparent rather than black?
The gdal_edit utility allows changing the NODATA value without editing any pixels, just changing the metadata value.
gdal_edit -a_nodata 255 somefile.tif
will instruct programs to treat white (255) as nodata or null. It applies the same value for all bands of a multiband image, so if the above were an RGB image 255,255,255 becomes nodata.
gdalsetnull.py is a simple python script to set specified raster value NODATA, without creating a new raster. The easiest route to installing GDAL on windows is via OSGeo4W. Examples:
python gdalsetnull.py foobar.tif 0 # pure black is transparent
python gdalsetnull.py foobar.tif 0 255 0 # pure green is
python gdalsetnull.py foobar.tif 50 23 77 100 # arbitrary value in 4 band image
If you don't mind some processing overhead and creating a new image rather than editing in place there is also gdal_calc which allows actually changing the cell values rather than just updating the metadata.
Set values of zero and below to null:
gdal_calc.py -A input.tif --outfile=result.tif --calc="A*(A>0)" --NoDataValue=0
Update 2020-Feb: added gdal_edit.
In concept, you need to figure out what pixel values represent cells with no data and then edit your color table to assign the RED,GREEN,BLUE (RGB) values in the color table to be 255,255,255 for that cell value.
If you don't have the appropriate license to do this in Arc, you could use the gdal_translate tool (one of the gdal/ogr commandline tools)
export the color table for your tif as an XML file.
gdal_translate -of VRT myImage.tif outColorTable.vrt
open up the .vrt file in a text editor and find the entry for the value of your no data pixels. There isn't an index number for the cell values, so you have to count down to the correct entry.
edit this value to be
<Entry c1="255" c2="255" c3="255" c4="255"/>
now, create a new tif based on the new color table
gdal_translate outColorTable.vrt newCorrected.tif
(example added based on comment below)
When I run the command in item #2 above and open up the .vrt file in a text editor, I see XML contents.
Part of the file includes lines that look like this, I have snipped most of them out.
Besides that you preferred NOT to create a new SLD file, here is a blog entry on how to convert the internal colormap of a GeoTIFF to a SymbologyEncoding/SLD and define another colour there. In the derived SLD it is easy to define exactly which values to render with a 100% transparent color.