[gdal-dev] Color-palette file for use in rgb2pct
Jan Hartmann
j.l.h.hartmann at uva.nl
Mon Feb 1 06:46:51 EST 2010
Hi Frank, could this be added to the documentation?
Jan
On 1-2-2010 12:37, Frank Warmerdam wrote:
> Luuk Schaminee wrote:
>> Hi,
>>
>> I am trying to convert a 24 bit RGB TIFF file to a 8 bit TIFF file.
>> Without the –pct option this works perfectly but I want to control
>> the created colors with a palette file. So I tried the following
>> command:
>> rgb2pct -pct c:\color_file.txt c:\image.tif e:\new_image.tif.
> ...
>> So now my question. What format must the palette file be in? and can
>> you give me a working example.
>
> Luuk,
>
> The palette must be in a GDAL supported raster file format (ie. TIFF,
> PNG, GIF, etc). Likely the easiest format for you to prepare manually
> would be VRT format. The following VRT is one with a small color table
> and no actual raster data:
>
>
> <VRTDataset rasterXSize="226" rasterYSize="271">
> <Metadata/>
> <VRTRasterBand dataType="Byte" band="1">
> <ColorInterp>Palette</ColorInterp>
> <ColorTable>
> <Entry c1="238" c2="238" c3="238" c4="255"/>
> <Entry c1="237" c2="237" c3="237" c4="255"/>
> <Entry c1="236" c2="236" c3="236" c4="255"/>
> <Entry c1="229" c2="229" c3="229" c4="255"/>
> </ColorTable>
> </VRTRasterBand>
> </VRTDataset>
>
> The c1/c2/c3/c4 entries are the red, green, blue and alpha components
> of color entries. You can have up to 256 entries in a normal file.
>
> Best regards,
More information about the gdal-dev
mailing list