[gdal-dev] Can't edit alpha in palette through VRT
Even Rouault
even.rouault at spatialys.com
Fri Mar 24 06:51:56 PDT 2017
On vendredi 24 mars 2017 13:36:35 CET Rahkonen Jukka (MML) wrote:
> Hi,
>
> I am following the FAQ "How to create or modify an image color table?" from
> https://trac.osgeo.org/gdal/wiki/FAQRaster
>
> I took out the palette from existing tiff file into VRT and I would like to
> change alpha value of the first input from 255 into 0.
>
> I had originally this:
>
> <VRTDataset rasterXSize="734" rasterYSize="565">
> <VRTRasterBand dataType="Byte" band="1">
> <ColorInterp>Palette</ColorInterp>
> <ColorTable>
> <Entry c1="255" c2="255" c3="255" c4="255" />
> <Entry c1="0" c2="0" c3="0" c4="255" />
> ...
> Then I edited the VRT into
>
> <ColorTable>
> <Entry c1="60" c2="255" c3="255" c4="0" />
> <Entry c1="0" c2="0" c3="0" c4="255" />
> ...
>
>
> Then I executed
> gdal_translate fixed_palette.vrt fixed palette.tif
>
> However, the result is not exactly what I hoped for:
>
> Band 1 Block=734x11 Type=Byte, ColorInterp=Palette
> Color Table (RGB with 256 entries)
> 0: 60,255,255,255
> 1: 0,0,0,255
>
> The value "60" for the red band is taken from my edited palette but my
> edited alpha value is not honored. Am I doing something wrong?
No, this is a TIFF limitation. The format doesn't support the alpha component in color tables.
You might workaround this by setting the NODATA value to 0 instead.
>
> -Jukka Rahkonen-
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170324/34769b4d/attachment-0001.html>
More information about the gdal-dev
mailing list