You can use BigBufferedImage . It has the real benefit that it saves the image on the hard drive and you donβt need to worry about the heap size or the physical memory limit . It can store a maximum of 2,147,483,647 pixels (or 46.340 x 46.340 pixels).
Create an empty BigBufferedImage:
BigBufferedImage image = BigBufferedImage.create( tempDir, width, height, type);
Load an existing image in BigBufferedImage:
BigBufferedImage image = BigBufferedImage.create( imagePath, tempDir, type);
Display part of image:
part = image.getSubimage(x, y, width, height);
For more information on large image processing, read this article .
Jhead source share