[gdal-dev] gdal_merge and the treatment of nodata value

Frank Warmerdam warmerdam at pobox.com
Wed Sep 3 10:17:42 EDT 2008

Andreas Neumann wrote:
> Hi,
> I am using gdal_merge to merge different rasters. The problem is that the
> nodata values appear as black and I want to have them white.
> Is there an option to set nodata values to white with gdal_merge? Or would
> I have to do this as a postprocessing?
> The problem is that the images are too large to be opened in an
> interactive application like Photoshop and Gimp. Otherwise I would correct
> it in there.
> Thanks for an idea on how to add nodata as white to my gdal_merge workflow.


I can't answer this without knowing more about your image configuration
and what applications you are using to judge that the nodata is white.

Does the image have a colormap?

What is the nodata value?

What is the pixel type?

What are typical image values?

If the image does not have a colormap, and the nodata value is larger
than the typical image values, then most applications that don't treat
nodata values specially will just treat them as white or a more intense
value than the rest of the image values.

If the image has a colormap then there may be options available to alter
the colormap, though this will depend on the file format, and perhaps
you capacity to write a small script.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list