I have a gray scale tiff image. I can extract the values from this tiff using numpy and make a new image with blue scale. But how can I convert it to shades of blue instead of shades of gray directly from the Tiff? Is it even possible?

Edit: Well I have two sets of tiff images(data), one with color-palette and another with gray scale ,I could generate tiles from color-palette one using generate_tiles.py, and show them on a map, but with gray scale one I can't do that, so I am wondering if I could change this gray scale tiff to color-palette one (with custom colours) so I can generate tiles and visualize the data.

  • 1
    It might help if you can show what you've already done / tried, what worked and what didn't work.
    – BradHards
    Mar 28, 2014 at 10:44

1 Answer 1


It depends what you want exactly.

1) most GIS software will allow you to change the symbology of a one band raster in order to display it in scales of blue. In some cases you can can store a colormap with your image, but this implies some kind of discretization.

2) If you want a 'true' colored image, you need to create a three band RGB (red/green/blue). Therefore, stack two constant raster of zero value with your gray scale image (zeros/zeros/gray_scale). you can do this with gdalbuildvrt -separate (create vrt with 3 bands), then gdal_translate (vrt to tif). Note that this will increase the size of your image, and is thus rarely the best solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.