I have a geotiff that I am importing to a mapping software that I want in the color pink. It is currently a white image, and I would like a GDAL option to change the color.

I am using Mapbox, which requires an 8-bit .tiff format. I had a 16-bit tiff that I "rescaled" using gdal_translate -of GTiff -ot Byte -scale 0 65535 0 255 src_dataset dst_datase, which worked. So now, I have an 8-bit geotiff that I've imported as a layer into Mapbox, but it visualizes as white, and I wish to change to pink.

enter image description here

  • 1
    You need to provide more information. What mapping software are you using? Do you have a multi-band TIFF or a single band TIFF. A 'white image" makes no sense unless there are some display settings in your mapping software that are causing it to look like that, or all the values of the pixels are the same. Can you provide screen-shots? – GBG May 9 '19 at 17:58
  • You can specify -scale once for each band, so figure out the ratio that gives the pink you're looking for and scale accordingly. If you want more control, gdal_dem can apply an actual color ramp – mikewatt May 9 '19 at 19:14
  • @mikewatt thanks, that helped in terms of actually having some manipulation in the colors. However, it seems my only options are from black to white, so I can get greys along that spectrum as well. Any suggestions on this? Perhaps my original tif is greyscale only, and I need to translate to an RGB image? Thanks for your help, either way I was able to make it more to my liking... – alexandersupertramp May 9 '19 at 21:11
  • Still using gdal_translate? Try specifying the band ordering with -b to make it 3 band, e.g. gdal_translate -b 1 -b 1 -b 1 .... I'll recommend again using gdal_dem, though – mikewatt May 10 '19 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.