TwelveMonkeys
TwelveMonkeys copied to clipboard
Support for large images (> 2GB)
There is need for reading larger images than what can be created using the normal BufferedImage
class and supporting Java2D classes. Currently, SampleModel
(used by WritableRaster
) has a restriction that width * height <= Integer.MAX_VALUE
(as it uses int
for index into the DataBuffer
). Also, the most common type of images (TYPE_nBYTE_xxx
) has a restriction that width * height * n <= Integer.MAX_VALUE
, which further restricts the size of the images.
The RenderedImage
(and WritableRenderedImage
) interface that BufferedImage
implements, has support for tiling. But there is no implementation of this tiling mechanism in the standard Java2D classes (TiledImage
which is a subclass of PlanarImage
does exist in Java Advanced Imaging, JAI). Further, as there is support for reading Raster
s directly, it would be useful to have tiling for Raster
s as well.
Because of the mentioned limitation of SampleModel
, we should use the SampleModel
only to control the tile size, and keep the full size of the image data in the Raster
subclass.
-- Harald K