[gdal-dev] Modify original ColorTable in VRT & TIFF files
Hotmail
rlelamer at hotmail.fr
Thu Apr 22 11:25:27 PDT 2021
Hi all,
I'm looking to modify the original ColorTable, when georeferencing, PNG => gdal_translate + gdalwarp => TIFF.
> gdal_translate -of VRT -a_srs EPSG:4326 file_png file_vrt -a_ullr xxxx
> gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3857 file_vrt file_tiff
If I open the VRT file and do the edit manually, the output TIFF file is correct.
The problem is that I have 524288 files ... so I would like to do the modification automatically, via gdal_translate.
But I don't quite understand using the parameters of the command ...
• Original VRT & TIFF files
# VRT
<VRTRasterBand dataType="Byte" band="1">
<ColorInterp>Palette</ColorInterp>
<ColorTable>
<Entry c1="0" c2="0" c3="255" c4="255" />
<Entry c1="255" c2="255" c3="255" c4="255" />
<Entry c1="0" c2="0" c3="0" c4="255" />
[...]
<Entry c1="0" c2="0" c3="0" c4="255" />
</ColorTable>
</VRTRasterBand>
# TIFF
Band 1 Block=63153x1 Type=Byte, ColorInterp=Palette
Color Table (RGB with 256 entries)
0: 0,0,0,255
1: 255,255,255,255
2: 0,0,0,255
[...]
255: 0,0,0,255
I want this :
• Modified VRT and TIFF files
# VRT
<VRTRasterBand dataType="Byte" band="1">
<ColorInterp>Palette</ColorInterp>
<ColorTable>
<Entry c1="0" c2="0" c3="255" c4="255" />
<Entry c1="0" c2="255" c3="0" c4="255" />
<Entry c1="255" c2="0" c3="0" c4="255" />
[...]
<Entry c1="255" c2="0" c3="0" c4="255" />
</ColorTable>
</VRTRasterBand>
# TIFF
Band 1 Block=63153x1 Type=Byte, ColorInterp=Palette
Color Table (RGB with 256 entries)
0: 0,0,255,255
1: 0,255,0,255
2: 255,0,0,255
[...]
255: 255,0,0,255
Whatever I find, redirects me to gdaldem (which I can't use). In gdal_translate, it seems to me that the parameter -colorinterp_X might be suitable
but I can't find any concrete examples (or I have not looked in the right place).
I want to impose the following parameters:
Band 1
Type = Byte
ColorInterp = Palette
Color Table (RGB with 256 entries)
In ColorTable:
Entry 0 = 0,0,255,255
Entry 1 = 0,255,0,255
Entries 2 to 255 = 255,0,0,255
More information about the gdal-dev
mailing list