Skip to main content

Join images (tiles) with low memory footprint using JAI

3 replies [Last post]
mgryszko
Offline
Joined: 2006-05-05
Points: 0

I have the following problem: I try to join many tile images into a big image using Java2D and BufferedImage and then storing it as PNG or JPG. Memory usage is linear - for 4000x4000 pixel result image (16,000,000 pixel) I need 16 times more memory than for a 1,000,000 pixel image.

Is there a method of joining small images into a large image using a constant memory footprint using JAI? Any hints will be appreciated.

Best,

Marcin

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jppowell
Offline
Joined: 2007-03-14
Points: 0

Yes, you want to use the mosaicdescriptor class, see here: http://cse-mjmcl.cse.bris.ac.uk/blog/2007/07/27/1185530940001.html

This way each image is pulled when needed from the array of RenderedOps passed to the mosaicdescriptor class. I have successfully mosaiced over 2gb of tiles together using a modified version of this code.

mgryszko
Offline
Joined: 2006-05-05
Points: 0

The code seems even more simple than mine (using BufferedImage). Thank you for the tip.

Best,

Marcin

menchenkenner
Offline
Joined: 2010-11-22
Points: 0

Hey mgryszko, the link http://www.java.net/external?url=http://cse-mjmcl.cse.bris.ac.uk/blog/20... that you mentioned above is not working..
can you please mail me the reqd code at panda.anil1989@gmail.com.
Thank you