Cannot open a GeoTiff image that includes a color table

Hello,

It’s not really an issue for me (since QGIS can read this kind of images normally), just wanted to point out this issue.

So, I’ve got a GeoTiff image with a color table (the slope of a DEM) which was generated from a DEM using GrassGIS. And to be able to save the color table with this image in GrassGIS, the image had to be exported as a UInt16. When I try to open the resulting image with SNAP, I get the following error:

java.lang.IllegalArgumentException: intMap: keyRange > Short.MAX_VALUE
	at org.esa.snap.core.image.ImageManager.createIndexedImage(ImageManager.java:575)
	at org.esa.snap.core.image.ImageManager.createByteIndexedImage(ImageManager.java:469)
	at org.esa.snap.core.image.ImageManager.createColored1BandImage(ImageManager.java:292)
	at org.esa.snap.core.image.ImageManager.createColoredBandImage(ImageManager.java:278)
	at org.esa.snap.core.image.ColoredBandImageMultiLevelSource.createImage(ColoredBandImageMultiLevelSource.java:76)
	at com.bc.ceres.glevel.support.AbstractMultiLevelSource.getImage(AbstractMultiLevelSource.java:65)
	at com.bc.ceres.glayer.support.ImageLayer.getImage(ImageLayer.java:172)
	at org.esa.snap.ui.product.ProductSceneView.isPixelPosValid(ProductSceneView.java:1252)
	at org.esa.snap.ui.product.ProductSceneView.firePixelPosChanged(ProductSceneView.java:1258)
	at org.esa.snap.ui.product.ProductSceneView.setPixelPos(ProductSceneView.java:1298)
	at org.esa.snap.ui.product.ProductSceneView.access$600(ProductSceneView.java:127)
	at org.esa.snap.ui.product.ProductSceneView$LayerCanvasMouseHandler.updatePixelPos(ProductSceneView.java:1398)
	at org.esa.snap.ui.product.ProductSceneView$LayerCanvasMouseHandler.mouseMoved(ProductSceneView.java:1379)
	at java.awt.AWTEventMulticaster.mouseMoved(Unknown Source)
	at java.awt.Component.processMouseMotionEvent(Unknown Source)
	at javax.swing.JComponent.processMouseMotionEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
[catch] at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

You have reported it before:

Or is this issue different from the other?

Indeed, according to the error message both errors are the same (I didn’t notice), and both happened for images that were exported from GrassGIS.
Now that I think about both products, there is not really a difference between both regarding the format (INT). Although, for the product in this topic (the slope of the DEM), I’ve explicitely exported it as a UINT16 so that the color table is included. For the other product (the shadow), apparently since it’s just integer values by default (i.e. a mask), maybe it addded the color table as well.