I was hoping that the following command would give me an alpha-channel PNG which was transparent where the DEM has "nodata":
gdaldem color-relief -alpha -of png dem.tif palette.dat out.png
I get an RGBA PNG alright, but the alpha channel is completely opaque! Why?
I am reasonably convinced that there are "nodata" pixels in dem.tif, because if I add an
nv entry to the palette (with some garish colour), I get a lot of this colour in my output, and right where I expect it to be.
gdaldem --version says
GDAL 2.2.1, released 2017/06/23.