I need to save a large image on disk - so large it creates outofmemory errors (like 10000x10000 px). It's suppose to be a tiling and I have the tile stored in memory as a BufferedImage. I read something about TiledImage class being able to work only with part of image, the rest being stored on disk, but I haven't found a simple example of how to do this? Could you please point me to or create a tutorial for dummies on how to store a large image on disk without having it all in memory? Like "create large image straight on disk like this:", "access its part and store data in it like this:" or however it works..
I know this has been asked here a couple of times, but I read through all of that and googled a lot but still haven't found a whole working (or comprehendable) example. Maybe it's the language barrier, or I'm just stupid in this kinda stuff, anyway, help, please :)
I would just increase your maximum memory, it is much simpler. Try it with
-Xmx1g
on the command line.There is no magic to using tiles. You just break up your image into smaller images when you stitch together on the screen so it looks like a large one. e.g. Google maps do this.
Have you checked out DiskMemImage, from their documentation:
You can give a look to PNGJ, I created that library for a similar scenario.
Easy way to solve OutOfMemoryError in java is to increase the maximum heap size by using JVM options