[FWTools] dstnodata and cubic convolution

Frank Warmerdam warmerdam at pobox.com
Fri Feb 2 16:28:31 EST 2007

Wim Chalmet wrote:
> Hi,
> I am working with panchromatic satellite imagery, which has the typical 
> "black borders" around the image area.
> When using gdalwarp to reproject the imagery, I specifiy scrnodata and 
> dstnodata as 0, in order to make 0 look "transparent" in my image 
> viewer. This works fine. I also make sure that within my image area, 
> no black pixels occur, for visual purposes (i.e. each pixel within the 
> image area has a digital number of at least 1).
> The problem that I am encountering is that cubic convolution allows 
> pixel values - within the imagery area - to become black (digital number 
> 0), because of the formula of cubic convolution.
> This gives me problems, because when I then make 0 look transparent, it 
> appears as if I have holes in my image area.
> Would it make sense to not allow gdalwarp to change the pixel value from 
> something larger than 0 to 0, if the user specifies dstnodata as 0? Is 
> this currently possible with gdalwarp?


Unfortunately, this turns out to be quite hard to do the way things are
setup because the interpolator doesn't know about what the specific nodata
values are, it just gets a bitmask of which pixels are nodata from a
function which computes it from the pixels.

Would it be practical for your purposes to specify -dstalpha instead of
-dstnodata?  This would use alpha=0 to mark nodata values in the output
image and would allow zeros to be present as real data in areas where
alpha is 255.

PS. I've taken the liberty of cc:ing this to gdal-dev, since I think this
might have wider interest.

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    | President OSGeo, http://osgeo.org

More information about the FWTools mailing list