Saving huge map images causes java to run out of memory
Hunternif opened this issue ยท 3 comments
Here are some pointers as to how to fix this:
https://www.java.net/node/702454
https://www.java.net/node/672134
http://stackoverflow.com/questions/6705352/saving-large-images-raster-problem
http://stackoverflow.com/questions/6904752/write-tiled-output-of-tiff-using-imageio-in-java
I might have to download an external library at runtime: PNGJ for memory-efficient writing to PNG format, JAI for tiled TIFF or something else.
B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [antiqueatlas]: Exporting image from Atlas #0 to file C:\Users\jbros\Documents\Atlas 0.png [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [antiqueatlas]: Image size: 200400x19376 [B#347] 2016/04/06 15:50:50 [INFO] Exception in thread "Thread-49" [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.NegativeArraySizeException [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.awt.image.DataBufferInt.<init>(Unknown Source) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.awt.image.Raster.createPackedRaster(Unknown Source) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.awt.image.BufferedImage.<init>(Unknown Source) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at hunternif.mc.atlas.util.ExportImageUtil.exportPngImage(ExportImageUtil.java:117) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at hunternif.mc.atlas.client.gui.GuiAtlas.exportImage(GuiAtlas.java:417) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at hunternif.mc.atlas.client.gui.GuiAtlas.access$1300(GuiAtlas.java:45) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at hunternif.mc.atlas.client.gui.GuiAtlas$6$1.run(GuiAtlas.java:274) [B#347] 2016/04/06 15:50:50 [INFO] [15:50:50] [Thread-49/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at java.lang.Thread.run(Unknown Source)