[gdal-dev] Color-palette file for use in rgb2pct

Chaitanya kumar CH chaitanya.ch at gmail.com
Mon Feb 1 06:55:59 EST 2010


I'm on it.

On Mon, Feb 1, 2010 at 5:16 PM, Jan Hartmann <j.l.h.hartmann at uva.nl> wrote:

> 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,
>>
> _______________________________________________
> 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-9848167848
17.241582N 80.142635E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100201/c4401222/attachment.html


More information about the gdal-dev mailing list