[Gdal-dev] Mass Color Table conversion

Even Rouault even.rouault at mines-paris.org
Mon Oct 22 13:46:49 EDT 2007


Instead of checking files one by one at hand, you could try to do that 
automatically, with a line such as (not tried):
for i in *.tif; do gdalinfo $i | grep "0: 255,255,255,255" && mv 
$i /path/to/first/group/of/images; done

Le Monday 22 October 2007 19:14:33 Luca Casagrande, vous avez écrit :
> Hello everybody!
>
> I have got a lot of geoTIFF files that I am using as Tileindex inside
> Mapserver.
> I discovered that some of them have got the color table inverted and
> this is confirmed by Gdalinfo:
>
> One kind of raster:
> [..]
>  Color Table (RGB with 256 entries)
>     0: 255,255,255,255
>     1: 0,0,0,255
>     2: 0,0,0,255
> [..]
>
> The other kind:
> [..]
>  Color Table (RGB with 256 entries)
>     0: 0,0,0,255
>     1: 255,255,255,255
>     2: 0,0,0,255
> [..]
>
> The problem is that I need to assign transparency to white. I thought
> about creating 2 different groups of images, and then assigning the
> appropriate class, but i should check tiff one bye one :(
> One solution could be to change the Color Table for all images and set
> them to:
> 	0: 255,255,255,255
>     	1: 0,0,0,255
> 	[..]
>
> What do you think about this option? Is there a way for automating the
> conversion?
>
> Thanks
>
> Luca






More information about the Gdal-dev mailing list