[Gdal-dev] GDALWarp - NO_DATA Replace?

Frank Warmerdam warmerdam at pobox.com
Thu Nov 11 21:18:35 EST 2004


Jason Hughes wrote:
> Is there anyway to specify a pixel value to replace while warping.  I want a 
> way to differentiate between pixels in my image and the background that is 
> created from warping.
> 
> I'm overlaying NITF's on maps and I would like a way to not paint the 
> background.  So as a workaround  I'm making an intermediate file to replace 
> the values that equal my background color myself using GDALCreateCopy().  I 
> then make a third file to warp the image.  This seems terribly inefficient. 
> Your input is much appreciated.

Jason,

I'm not clear on exactly what you want to accomplish.  You can use the
-dstnodata argument to gdalwarp to specify a pixel value that will be used
to mark areas on the output image that were never set from a pixel in the
input image.  However, if there were pixels in the input image that had
that "dstnodata" value already you won't be able to distinguish them.

Another alternative is to add an alpha band which would be marked as
opaque for pixels copied from the source image, and transparent for pixels
that were never set during the warp.

Does one of these cases match your needs?

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