I have a couple of huge images which can't be loaded into the memory in whole. I know that the images are tiled and all the methods in the class ImageReader
give me plausible non zero return values for
getTileGridXOffset(int)
,
getTileGridYOffset(int)
,
getTileWidth(int)
and
getTileHeight(int)
.
My problem now is that I want to read one tile only to avoid having to load the entire image into memory using the ImageReader.readtTile(int, int, int)
method. But how do I determine what the valid values for the tile coordinates are?
There is the method getNumXTiles()
and getNumYTiles()
in the interface RenderedImage
but all attempts to create a rendered image from the source results into a out of memory/java heap space
error.
The tile coordinates can theoretically be anything and I tried readtTile(0, -1, -1)
which also works for a few images I tested.
I also tried to reach the metadata for those images but I didn't find any useful information regarding the image layout.
Is there anyone who can tell me how to get the values for the tile coordinates without having to read the entire image into memory? Is there another way which does not require an instance of ImageLayout
?
Thank you very much for your assistance.