On mardi 22 novembre 2016 09:08:02 CET Neumann, Andreas wrote: > Hi, > > Is there a way to store nodata values in GeoTiffs that don't match an > RGB value? I used either white or black as nodata values, but in some > rare cases these black or white pixel values do appear as valid data in > the image. > > How can I properly store nodata values in RGB Orthoimages in GeoTiffs > where the borders aren't purely rectangular? > > Would I have to use a hard mask for regions where there is no data, or > is there a trick with an alpha band? >
There are several potential issues: * by default, nodata is dealt band-per-band. So if you have nodata at 255, but a RGB triplet is (255,0,0), then it will be considered as nodata for the red band, but valid for the green and blue bands. To avoid that you can set the "NODATA_VALUES=255 255 55" metadata item to indicate that the 3 components must match at the same time. For example with: gdal_edit.py foo.tif -mo "NODATA_VALUES=255 255 55" -unsetnodata Then gdaladdo should properly take that into account * If you indeed have valid pixels at (255,255,255) in the middle of the raster, then the above is not sufficient, and you need to create a dedicated alpha channel or mask band that gdaladdo will honour as well. You can do that with nearblack -white -setalpha/-setmask Even -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
