I have a large number of single band rasters that are colour indexed TIF files. I want to mosaic them using GDAL (or similar non-proprietary software with a Python API I can call as part of a bigger script).
The images all represent the same sort of thing but the information is embedded in the colour tables for each image and not the raster pixel value as such (i.e. all the colour tables are independent). So, sky-blue (say) always means the same thing but does not always have the same position in the different colour tables.
Mosaicing them is easy as a greyscale image, but then I lose the colour information which is vital. I can't use the '-pct' switch in gdal_merge.py because that only grabs the first colour table and causes some or all of the other tiles in the mosaic to display incorrectly.
My gut feeling is that there is nothing for it but to convert all the images to three-band RGB (and consequently balooning the data volume) and mosaic the images with a possible post process step to create a new unified colour table and swap the mode back to single band indexed colour.
However, I'd value opinion and work-flow suggestions on this (the process must be automatable). Is there a better way of doing it?
EDIT:
To be clear, I have no way of knowing whether any particular tile contains the full range of colours represented by all the tiles together.
