drawRenderedImage leads to out of memory error - print as tiles?

M

Morten Nørgaard

Hi,

I'm having severe difficulties printing a BufferedImage - I get the out
of memory error. I suppose I'll need a different approach to my printing,
wherefore I hope someone finds the time to suggest me one. Basically what I
need is to take a small piece out of so and so many TIFF images and print
these side by side. My approach is to retrieve all the TIFF images as
RenderedImages via JAI and return the pieces of them by cropping them to
RenderedOp-images. I then create a BufferedImage to hold these pieces, and
use the getAsBufferedImage() method to draw the RenderedOp-images to this
BufferedImage (via its graphics-context, of course). Having done this, I
create a Graphics2D object and use the drawRenderedImage of this to draw my
BufferedImage. This is the Graphics object that gets printed. Ideally, i.e.;
I consume the memory entire, and get nowhere.

I've looked up and down for solutions to this, and suspect I've damn near
stared myself blind, so to speak. I'm sure there must be a simpler way to do
it than the one I've described, and truly welcome all suggestions. One
possible solution is printing the BufferedImage as tiles - yet I don't see
why this should be necessary, as the images are light (500KB tops) and
should easily fit into memory. Also I'm brought to a halt by the sheer fact
that I can find no info on how to go about printing images as tiles - I'd
sure appreciate a helpful link (but please not to the jai documentation -
it's out of my league).

Thank you,


Morten
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top