[FWTools] gd_merge black background

Matt Wilkie matt.wilkie at gov.yk.ca
Fri Apr 20 13:48:53 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?
...
> 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.

for example:

   gdalwarp -srcnodata 0 -dstnodata 255  [list of in images] output.tif

will treat all black pixels in the input images as nodata, converting 
them to white in the output image (but still marked as nodata. Programs 
which are nodata aware will draw them as transparent). Don't use cubic 
resampling (-rc or -rcs) as it does not respect nodata cleanly at 
present (there will be black pixels at the seams).

http://www.gdal.org/gdalwarp.html

cheers,

-- 
matt wilkie
--------------------------------------------
Geographic Information,
Information Management and Technology,
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
http://environmentyukon.gov.yk.ca/geomatics/
--------------------------------------------



More information about the FWTools mailing list