Re: exporting single banc with a colormap to RGB.tif

Sean Gillies


The library doesn't automatically convert single band color-mapped data to 3-band RGB data. You'll need to construct a new output array filled with values from the colormap and then write that to the output file. Numpy will help: make a new 2D array and replace index values with an [R, G, B] array from the colormap, then use numpy.moveaxis to turn this into a 3-band array that rasterio can write.

On Fri, Dec 6, 2019 at 7:25 PM Eyal Saiet <ejsaiet@...> wrote:
I could not figure out how to export a single band with a colormap as an RGB.tif
A snippet of my code:
with,'w',**raster_cmp_p) as dst:
    dst.write_colormap(1, f_dic)



Eyal Saiet

The mind is not a vessel to be filled, but a fire to be kindled. Plutarch

Sean Gillies

Join to automatically receive all group messages.