Skip to main content

creating multiple BufferedImage runs out of meory

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
steve_yange
Offline
Joined: 2013-06-05

We have a 403 page, 59MB tiff file. It's resolution is 1674 * 2256; format is TIFF6. The requiremnt is to extract 309 pages out of the total 403 page and merge/concatenate into a new multi page tiff file. The page range is 14,20,22-206,262,264,266,268,286-403.

Our code is basically to create 309 BufferedImage objects and use ImageEncoder to encode objects. It runs out of memory when trying to create the BufferedImage objects. If we reduce the page range, it runs perfectly. The code has been in production for quite some time.

My question is that are there any alternatives/API to address this issue? Since on 32bit Windows, the max heap size could be 1.8GB only. There is no way to allocate more heap size.

Any help is appreciated.
Thanks,
Steve