1

I am working with rasterio and looking to modify a PNG by changing the order of values assigned to different colors. Using gdalinfo, this is what the image currently looks like. I have read [rasterio color]1, but it only changes the colors, it won't actually change the values.

Band 1 Block=587x13 Type=Byte, ColorInterp=Palette   Color Table (RGB with 256 entries)
    0: 32,64,96,255
    1: 0,0,0,255
    2: 16,64,0,255
    3: 32,80,0,255
    4: 255,255,255,255
    5: 36,84,20,255
    6: 52,84,116,255
    7: 52,100,20,255
    8: 84,116,20,255
    9: 100,132,20,255

And this is what I am looking to do (below). Not sure if it is practical or even works when working with images. The reason for the change is I need to convert the PNG to GRIB2; when I convert it assigns gridded values based on the original 1-9 order.

Band 1 Block=587x13 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    10: 52,84,116,255
    15: 16,64,0,255
WxJack
  • 21
  • 6

1 Answers1

0

I was able to accomplish the color transition by building my own VRT using GDAL.

WxJack
  • 21
  • 6