[gdal-dev] NoData vs metadata confusion

Even Rouault even.rouault at mines-paris.org
Thu Oct 28 08:01:26 EDT 2010


Oyvind,

The best abstraction to deal with a nodata triplet would be the NODATA_VALUES
metadata item at the dataset level described in
http://www.gdal.org/gdal_datamodel.html

You can do : gdal_translate your.sid your.tif -mo NODATA_VALUES="255 255 255"

Since a few GDAL releases this will results in an implicit mask band that will
only mark pixels where R=G=B=255 as transparent. However mask bands are not
honoured very much in GDAL. Unless you use latest trunk version where you could
do :

gdal_translate your.tif rgba.tif -b 1 -b 2 -b 3 -b mask -mo NODATA_VALUES=""

to make a RGBA image by translating the implicit mask band into a explicit alpha
channel.

> Thanks for fast reply !
>
> I assume the IMAGE__NO_DATA_VALUE=255,255,255 comes from the MrSid SDK
> library.
>
> These values could easily be mapped to the GDAL-bands NoData, as they
> practically means
> the same ? (255 for each band)
>
>
> -- Oyvind
>
>
> On Thu, Oct 28, 2010 at 1:09 PM, Chaitanya kumar CH
> <chaitanya.ch at gmail.com>wrote:
>
> > Oyvind,
> >
> > GDAL handles nodata values band by band, whereas in MrSID all the bands of
> > the particular pixel location must match the nodata values for that pixel
> to
> > be considered nodata.
> > Currently nodata values are ignored in this driver. I don't know if
> > anything is planned for future releases.
> >
> > On Thu, Oct 28, 2010 at 4:21 PM, Oyvind Idland
> <oyvind.idland at gmail.com>wrote:
> >
> >> Hello,
> >>
> >> stumbled across a problem when reading MrSid:
> >>
> >> The MrSid dataset contains 3 bands, R/G/B. None of the 3 bands gives me a
> >> GetNoDataValue(),
> >> however, the metadata contains IMAGE__NO_DATA_VALUE=255,255,255.
> >>
> >> Does this mean, that I have to check for both cases ?
> >>
> >> The version is GDAL 1.7.2.
> >>
> >>
> >> Regards,
> >>
> >>
> >> Oyvind Idland
> >>
> >> _______________________________________________
> >> gdal-dev mailing list
> >> gdal-dev at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >>
> >
> >
> >
> > --
> > Best regards,
> > Chaitanya kumar CH.
> > /tʃaɪθənjə/ /kʊmɑr/
> > +91-9494447584
> > 17.2416N 80.1426E
> >
>




More information about the gdal-dev mailing list