Captain-Chaos / WorldPainter

WorldPainter is an interactive graphical map generator for the indie game Minecraft.
http://www.worldpainter.net/
GNU General Public License v3.0
341 stars 58 forks source link

[BUG] Cannot load a compressed int16 TIF from scripts #390

Open atmosphericbeats opened 1 month ago

atmosphericbeats commented 1 month ago

When I try to load a compressed TIF (compress=LZW. predictor=2, type=int16) from a script using

var heightMap = wp.getHeightMap().fromFile('E:/test.tif').go();

I got this error. However, if I load the same TIF from the GUI, the heightmap is correctly imported into the map. Running the script directly from the GUI, not using wpscript, works as well:

[ERROR] RuntimeException occurred while executing worldpainter.js
java.lang.RuntimeException: org.pepsoft.worldpainter.tools.scripts.ScriptException: I/O error while loading image E:/test.tif

Caused by: org.pepsoft.worldpainter.tools.scripts.ScriptException: I/O error while loading image E:/test.tif
        at org.pepsoft.worldpainter.tools.scripts.GetHeightMapOp.go(GetHeightMapOp.java:84)
        at org.openjdk.nashorn.internal.scripts.Script$worldpainter.:program(worldpainter.js:27)
        at org.openjdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:646)
        at org.openjdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:513)
        at org.openjdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:520)
        ... 11 common frames omitted

Caused by: javax.imageio.IIOException: **16-bit samples are not supported for Horizontal differencing Predictor**
        at java.desktop/com.sun.imageio.plugins.tiff.TIFFLZWDecompressor.decodeRaw(TIFFLZWDecompressor.java:90)
        at java.desktop/com.sun.imageio.plugins.tiff.TIFFDecompressor.decodeRaw(TIFFDecompressor.java:1911)
        at java.desktop/com.sun.imageio.plugins.tiff.TIFFDecompressor.decode(TIFFDecompressor.java:2553)
        at java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.decodeTile(TIFFImageReader.java:1142)
        at java.desktop/com.sun.imageio.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1361)
        at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1466)
        at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1315)
        at org.pepsoft.worldpainter.tools.scripts.GetHeightMapOp.go(GetHeightMapOp.java:73)
        ... 15 common frames omitted
Captain-Chaos commented 1 month ago

It's extremely strange that the same script works when you run it from the GUI, but not not from wpscript. It's the same code that gets invoked. Is it possible that when you run wpscript from the command line a different Java version is the default than when you run the GUI?