[FWTools] gd_merge black background

Frank Warmerdam warmerdam at pobox.com
Fri Apr 20 11:54:58 EDT 2007


Jerry O'Sullivan wrote:
> Hi,
>  
> I am merging some rasters together that are not spatially contiguous, 
> i.e. there are gaps in the coverage this is getting filled up with black 
> pixels, How can I get these pixes to be transparent or not created?

Jerry,

Well, "no creating" them isn't really an option as gdal_merge produces
a rectangular output image.  Something has to be in the gaps.

You can use the -init switch to gdal_merge to pre-initialize the file
to some particular value which you could then try and mark as a nodata
value for applications that support that.

But gdal_merge.py has no support for an alpha layer for marking transparent
pixels.  If you wanted to do so, it could likely be added to the script.

The gdalwarp program can also be used to mosaic images, and supports the
-dstalpha switch will cause an alpha band to be created on the resulting
file, and it will be set to transparent where no data is assigned, and
opaque where there is data.

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