[gdal-dev] gdalbuildvrt -init 255
even.rouault at mines-paris.org
Mon Jan 4 16:08:03 EST 2010
I don't think the issue is really about black or white, but more about
setting nodata appropriately. Basically, if I've well understood your
needs, you want to make some black padding in images transparent.
Assuming that your imagery is RGB, you could try adding -srcnodata 0 to
the gdalbuildvrt command line, so that pixels with value 0 in source
imaginery are not drawn in the VRT buffer. You will also need to specify
a -vrtnodata XXX (which is about like -init XXX of gdal_merge.py, but
does more than -init as it sets that value as nodata), where XXX can be
255 if you want it to be nodata white, but 0 should also do, but the
value should not matter much to QGIS : it should just ignore the pixels
matching the nodata value whichever it is.
You must be aware of the limitation of the nodata concept when working
with RGB imagery however. Nodata is considered band per band, and not as
a triplet. I mean if you have a blue pixel (0,0,255), and you set a
nodata value of 255 for each of the 3 bands, the blue component of
(0,0,255) being 255, it will be considered as nodata for that
component... The only proper way to deal with that is to work with RGBA
> By default, gdal_merge.py starts by creating an output image with all black pixels, and then replaces these black pixels with pixels from the images being read in. Passing to gdal_merge.py -init 255 pre-initializes the output image to all white, instead of all black, pixels.
> Similar to gdal_merge.py, gdalbuildvrt fills with black pixels. I am seeking for gdalbuildvrt, the -init 255 option that gdal_merge.py supports, but do not see -init 255 as a supported option on the gdalbuildvrt man page. In GDAL 1.7.0, will gdalbuildvrt support -init 255? If not, then in GAL 1.7.0 can the option -vrtnodata be used in a way similar to how gdal_merge.py supports -init 255? I need areas where there is no image to be white, rather than the black that gdalbuildvrt is by default setting them to be.
> gdal_merge.py man page
> gdalbuildvrt man page
> gdalbuild_black image
> gdalbuildvrt_white image (simulated)
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
More information about the gdal-dev