[gdal-dev] buildvrt and reverse BW images

Even Rouault even.rouault at spatialys.com
Tue May 19 09:13:58 PDT 2015


Le mardi 19 mai 2015 16:48:20, Paolo Cavallini a écrit :
> Hi all.
> I have several images, appearing correctly in BW, but with different
> color tables:
> 
>   Color Table (RGB with 2 entries)
>     0: 255,255,255,255
>     1: 0,0,0,255
> 
>   Color Table (RGB with 2 entries)
>     0: 0,0,0,255
>     1: 255,255,255,255
> 
> When building a virtual raster, obviously they appear reversed (some BW,
> some WB). Is there a way to build a uniform virtual raster, without
> manually changing the single rasters?

Well, you could cheat a bit by generating inverted VRT for one of the two 
categories with :
gdal_translate in.tif -scale 1 0 0 1 inverted.vrt -of vrt
(if you display it it will not be consistent since only the values will be 
inverted, not the color table, but that's not important since the mosaic VRT 
ignore the color table of individual sources)
And then gdalbuildvrt the "reference" images and the inverted VRTs (make sure 
you put in first in the list a "reference" image so it color palettes gets 
selected)


> 
> Thanks.

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list