[Gdal-dev] gdalwarp nodata

Frank Warmerdam warmerdam at pobox.com
Sat Nov 13 14:13:47 EST 2004


Richard Greenwood wrote:
> So would gdalwarp recognize an alpha channel, or would I specify
> additional options? I am not too familiar with the use of alpha
> channels is it  0->255 corresponding to transparent->opaque?
> 
> Yes, an example script would be wonderful, but I don't mean to impose on you.

Rich,

OK I have attached a little script that takes in an RGB file, and outputs
an RGBA file with alpha set to transparent(0) where the condition is met, and
to opaque(255) where it isn't set.

However, to my dismay I find that gdawarp does *not* honour alpha values
coming from the source image so this doesn't do you too much good.  You
could use a slight variation on this script to alter all pixels that
have red, green or blue values of 255 for pixels where everything isn't 255 to
use 254 instead.  Then the existing gdalwarp -srcnodata support should work
properly.

I, on the other hand, will now have to tie in the alpha blending support
properly in gdalwarp. If you aren't in a hurry you might just want to wait
for that to be complete.

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