You can use BigBufferedImage instead of BufferedImage. BigBufferedImage has the real benefit that it saves the image on your hard drive, and you don't have to worry about heap size or physical memory limit. It can store a maximum of 2,147,483,647 pixels (or 46.340 x 46.340 pixels).
Create az 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