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.

I downloaded FWTools 2.4.6 (for Windows) to try it out, but unfortunately it 
doesn’t work the way I want. It is possible the format I saved the palette file 
in, is wrong.
I tried several versions:
This one for example:
500 255 255 255
450 235 220 175
300 190 185 135
150 240 250 150
76 50  180  50
75 200 230 255
-32768 200 230 255

Or this one:
0: 0,0,0,0
1: 251,0,0,64
2: 250,0,0,54
3: 253,0,0,114
4: 254,0,0,176
5: 254,0,0,224
6: 254,0,0,228
7: 254,0,0,252
8: 253,0,0,168
9: 254,0,0,170

I keep getting the following error:
ERROR 4: `c:\color_file.txt' not recognised as a supported file format.
Traceback (most recent call last):
  File "C:\FWTOOL~1.6\bin\rgb2pct.py", line 121, in ?
    ct = pct_ds.GetRasterBand(1).GetRasterColorTable().Clone()
AttributeError: 'NoneType' object has no attribute 'GetRasterBand'

I changed the rgb2pct Python file to print the palette file name as a check and 
it gives the error “ERROR 4: `c:\color_file.txt' not recognised as a supported 
file format.”
If I delete the added line (“print pct_filename” above the line “if 
pct_filename is None:”) this error is gone again, but not the next.

So now my question. What format must the palette file be in? and can you give 
me a working example.

Many thanks,

Luuk Schaminee_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to