3

I want to add color, using RGB values stored in a CPT file, to a black and white Int16 GeoTIFF file using Python.

I tried to use SetColorEntry(), but when I add the ColorTable to the RasterBand, I get the following error:

ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.

The GeoTIFF is a bathymetry where the values range from -5000 to 50. Using Byte or UInt16 would result in a lot of data loss

Can someone help me out and point me in the right direction?

asked Jun 8, 2017 at 7:04

1 Answer 1

0

You need to use gdal.GPI_RGB or gdal.GDT_UInt16 and not gdal.GDT_Int16.
That's the idea behind this error !

answered Jan 23, 2020 at 16:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.