Exception found when reading compressed TIF

When importing a GeoTIFF file with a compression, an “Unexpected Exception” is reported: “javax.imageio.IIOException: 16-bit samples are not supported for Horizontal differencing Predictor”.
Using GDAL I checked the GeoTIFF file has the characteristic “COMPRESSION=DEFLATE”.
It may be related to TIFF/LZW decoder: https://github.com/geosolutions-it/imageio-ext/pull/77/files

Here the details of the unexpected exception:

javax.imageio.IIOException: 16-bit samples are not supported for Horizontal differencing Predictor
at it.geosolutions.imageioimpl.plugins.tiff.TIFFDeflateDecompressor.decodeRaw(TIFFDeflateDecompressor.java:120)
at it.geosolutions.imageio.plugins.tiff.TIFFDecompressor.decodeRaw(TIFFDecompressor.java:2048)
at it.geosolutions.imageio.plugins.tiff.TIFFDecompressor.decode(TIFFDecompressor.java:2644)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.decodeTile(TIFFImageReader.java:1505)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1806)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFRenderedImage.read(TIFFRenderedImage.java:300)
Caused: java.lang.RuntimeException
at it.geosolutions.imageioimpl.plugins.tiff.TIFFRenderedImage.read(TIFFRenderedImage.java:307)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFRenderedImage.getData(TIFFRenderedImage.java:284)
at org.esa.snap.dataio.geotiff.GeoTiffProductReader.readRect(GeoTiffProductReader.java:258)
at org.esa.snap.dataio.geotiff.GeoTiffProductReader.readBandRasterDataImpl(GeoTiffProductReader.java:160)
at org.esa.snap.core.dataio.AbstractProductReader.readBandRasterData(AbstractProductReader.java:250)
at org.esa.snap.core.image.BandOpImage.computeProductData(BandOpImage.java:67)
at org.esa.snap.core.image.RasterDataNodeOpImage.computeRect(RasterDataNodeOpImage.java:127)
at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
at javax.media.jai.OpImage.getTile(OpImage.java:1129)
at org.esa.snap.core.datamodel.StxFactory.accumulateTile(StxFactory.java:339)
at org.esa.snap.core.datamodel.StxFactory.accumulate(StxFactory.java:323)
at org.esa.snap.core.datamodel.StxFactory.accumulate(StxFactory.java:296)
at org.esa.snap.core.datamodel.StxFactory.create(StxFactory.java:200)
at org.esa.snap.core.datamodel.StxFactory.create(StxFactory.java:274)
at org.esa.snap.core.datamodel.RasterDataNode.computeStxImpl(RasterDataNode.java:2227)
at org.esa.snap.core.datamodel.Band.computeStxImpl(Band.java:505)
at org.esa.snap.core.datamodel.RasterDataNode.getStx(RasterDataNode.java:2194)
at org.esa.snap.core.datamodel.RasterDataNode.createDefaultImageInfo(RasterDataNode.java:1642)
at org.esa.snap.core.datamodel.Band.createDefaultImageInfo(Band.java:484)
at org.esa.snap.core.datamodel.RasterDataNode.getImageInfo(RasterDataNode.java:1624)
at org.esa.snap.core.datamodel.RasterDataNode.getImageInfo(RasterDataNode.java:1607)
at org.esa.snap.core.image.ImageManager.prepareImageInfos(ImageManager.java:904)
at org.esa.snap.core.image.BandImageMultiLevelSource.create(BandImageMultiLevelSource.java:51)
at org.esa.snap.core.image.BandImageMultiLevelSource.create(BandImageMultiLevelSource.java:47)
at org.esa.snap.core.image.BandImageMultiLevelSource.create(BandImageMultiLevelSource.java:41)
at org.esa.snap.ui.product.ProductSceneImage.(ProductSceneImage.java:69)
at org.esa.snap.rcp.actions.window.OpenImageViewAction.createProductSceneImage(OpenImageViewAction.java:181)
at org.esa.snap.rcp.actions.window.OpenImageViewAction.access$000(OpenImageViewAction.java:61)
at org.esa.snap.rcp.actions.window.OpenImageViewAction$1.doInBackground(OpenImageViewAction.java:129)
at org.esa.snap.rcp.actions.window.OpenImageViewAction$1.doInBackground(OpenImageViewAction.java:124)
at com.bc.ceres.swing.progress.ProgressMonitorSwingWorker.doInBackground(ProgressMonitorSwingWorker.java:55)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused: java.util.concurrent.ExecutionException
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at javax.swing.SwingWorker.get(Unknown Source)
[catch] at org.esa.snap.rcp.actions.window.OpenImageViewAction$1.done(OpenImageViewAction.java:143)
at javax.swing.SwingWorker$5.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
at sun.swing.AccumulativeRunnable.run(Unknown Source)
at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(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.awt.EventQueue.dispatchEvent(Unknown Source)
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)

Federico

Thanks for reporting this Federico.
Can you provide an example file? I haven’t found any.

I have found this problem when trying to visualize LANDSAT data downloaded from Amazon Web Services.
Data are correctly opened in SNAP (both *MTL.txt and single .TIF band). The “Unexpected Exception” is reported when trying to visualize the bands or perform any calculation (e.g. band math).

Please find a compressed GeoTIFF data sample at this link:

http://landsat-pds.s3.amazonaws.com/L8/139/045/LC81390452014295LGN00/index.html

Federico

Thanks for giving the link to the data.
I’ve added this to our issue tracker.
https://senbox.atlassian.net/browse/SIIITBX-80

I just experience a similar error “16-bit samples are not supported for Horizontal differencing Predictor” from Radar Terrain-Correction on my Linux server. Turns out my DEM was LZW compressed TIFF. Thanks to this forum I am now processing on my Linux server after just using gdal_translate to create an uncompressed version of the DEM.

I had been running the Terrain-Correction on my Windows desktop as a work around. Evidently the windows TIFF library correctly processes LZW data but not the Linux version. Both versions of SNAP are 3.0.

2 Likes

@s0sh0rt Thanks for sharing this information. This might be helpful also for others.

hi i have this problem on my windows 7 “32-bit samples are not supported horizontal differencing predictor” when using images.tiffam working with images sentinel 2 on Snap
any help please

Yes, this issue is not yet solved. But from where do you get S2 data in GeoTiff format?

okey
i have downloaded my images from earth explorel and Esa so i did the atrmospheric correction on Qgis , the result was images.tiff
so i want to compleet the traitement on Esa Snap wich is calculate the vegetation indix but i have this problem
anyway thank u