[gdal-dev] Can't edit alpha in palette through VRT

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Fri Mar 24 06:36:35 PDT 2017


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?

-Jukka Rahkonen-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170324/38b8495d/attachment-0001.html>


More information about the gdal-dev mailing list