Skip to main content
added 31 characters in body
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

I did not find ready made tool for that. Could be a good option to add into gdal_edit.py.

Meanwhile you can remove the colortable with GDAL and Python. Writing an empty colortable seems to effect like delete.

from osgeo import gdal
ds = gdal.Open('palette.tif',gdal.GA_Update)
ct = gdal.ColorTable()
ds.GetRasterBand(1).SetRasterColorTable(ct)
ct = None
ds = None
from osgeo import gdal

ds = gdal.Open('palette.tif',gdal.GA_Update)
ct = gdal.ColorTable()
ds.GetRasterBand(1).SetRasterColorTable(ct)
ct = None
ds = None

Before:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

After:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Gray

I did not find ready made tool for that. Could be a good option to add into gdal_edit.py.

Meanwhile you can remove the colortable with GDAL and Python. Writing an empty colortable seems to effect like delete.

from osgeo import gdal
ds = gdal.Open('palette.tif',gdal.GA_Update)
ct = gdal.ColorTable()
ds.GetRasterBand(1).SetRasterColorTable(ct)
ct = None
ds = None

Before:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

After:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Gray

I did not find ready made tool for that. Could be a good option to add into gdal_edit.py.

Meanwhile you can remove the colortable with GDAL and Python. Writing an empty colortable seems to effect like delete.

from osgeo import gdal

ds = gdal.Open('palette.tif',gdal.GA_Update)
ct = gdal.ColorTable()
ds.GetRasterBand(1).SetRasterColorTable(ct)
ct = None
ds = None

Before:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

After:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Gray
Source Link
user30184
  • 69.1k
  • 4
  • 71
  • 125

I did not find ready made tool for that. Could be a good option to add into gdal_edit.py.

Meanwhile you can remove the colortable with GDAL and Python. Writing an empty colortable seems to effect like delete.

from osgeo import gdal
ds = gdal.Open('palette.tif',gdal.GA_Update)
ct = gdal.ColorTable()
ds.GetRasterBand(1).SetRasterColorTable(ct)
ct = None
ds = None

Before:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

After:

Band 1 Block=1000x8 Type=Byte, ColorInterp=Gray