[Gdal-dev] nodata and gdal_merge
Richard Greenwood
richard.greenwood at gmail.com
Mon Feb 7 09:14:44 EST 2005
On Mon, 7 Feb 2005 09:45:03 +0100, mathieu_gdal <mathieu_gdal at yahoo.fr> wrote:
> Dear all,
>
> With gdal_merge, it is possible to specify a nodata value (-n).
> It works perfectly when it is applied to a single-band dataset.
>
> But, as the nodata value is a single value, how to make it work with a RGB
> image?
> For exemple, how to specify that the "red" color is the no data value?
>
> In advance, Thank you.
> -Mathieu
If you are working with tiffs, you can create an alpha channel (a 4th
band) which gdal can interpret as transparent. This might meet your
needs for a no-data value. I have used imagemagik to add an alpha
channel e.g.
convert rgb.tif -transparent #ff0000 rgba.tif
Would add an alpha channel in which red cells in the source are
transparent in the destination.
If gdal does not recognize the new alpha channel, you can use
-srcalpha and/or -dstalpha to tell it one exists.
Regards,
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com
More information about the Gdal-dev
mailing list