[gdal-dev] What is the purpose of -nosrcalpha in gdalwarp?

Even Rouault even.rouault at spatialys.com
Sun Nov 8 09:35:26 PST 2020


On dimanche 8 novembre 2020 16:33:20 CET Rahkonen Jukka (MML) wrote:
> Hi,
> 
> I noticed this question from gis.stackexchange
> https://gis.stackexchange.com/questions/378557/gdalwarp-does-not-use-lanczo
> s-resampling-on-image-with-alpha-channel/378569?noredirect=1#comment618912_3
> 78569
> 
> It seems that alpha band has some bad effect on the result of lanczos
> resampling and that can be avoided by using -noscralpha option. From the
> gdalwarp manual page: "Prevent the alpha band of a source image to be
> considered as such (it will be warped as a regular band)".
> The option has been added to GDAL version 2.2 but with no mention about any
> bug that it resolved.
> What is the difference between warping a band as an
> alpha band or as a regular band? How users are supposed to know when it is
> appropriate to use -nosrcalpha switch?

I don't remember the use case unfortunately. But an alpha band is wrapped in a 
particular way with alpha blending logic. -nosrcalpha doesn't affect only the 
way the alpha band is wrapped, but how other bands are. with -nosrcalpha, 
there's no alpha blending for other bands either.

For the gis.stackexchange case, the source image looks to have wrong metadata. 
When you look at the band of the supposedly alpha band, it doesn't look at all 
like an alpha band but as a regular one. And the nodata=255 setting is an 
extra weirdness.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list