Andrew,

Thanks very much for the reply!  Comments below:

Andrew M. Sheridan wrote:

John, hi.

Instead of performing an AffineTransformOp every time the user scales the
image, you may be able to take advantage of the Graphics2D
drawRenderedImage( RenderedImage, AffineTransform ) method.  This method
applies the AffineTransform to the image when it is drawn.  Using this
method may not reduce the amount of work or memory that your app uses,
but
it may simplify your code: you will only have to hang on to the original
or contrast adjusted image and not the scaled image.

Hmmm...a worthy point. I'm actually combining both Rescale and AffineTransform ops each time the user clicks an "Apply" button, and the levels each are set to are controlled by two JSliders. I'd probably have to make two calls to drawRenderedImage, but it'd still work. Thanks!

One note for performance.  For an image as large as 9.3mg, you might want
to perform contrast adjustment using a lookuptable.

I'm new the the imaging world...will have to research this. Thanks for the pointer.

2) Yes.  Instead of scaling via an AffineTransformOp, just draw it
scaled.

What do you mean by this? I'm not clear on the difference...

Do you have a stack trace showing the StackOverflowError?

Sorry if I was unclear. It's the standard java.lang.OutOfMemory error.

What's odd is that a JPEG that is 114k increases the program's memory
footprint immediately after loading (without applying transforms), by
approximately 10 megs in RAM and roughly 18 megs in Windows XP reported
VM Size:

Before loading:  Mem Usage: 18700K -- VM Size: 16856K
After loading: Mem Usage: 28656K  -- VM Size: 34304K  All that it does
is read the image in as a ImageIcon, convert the ImageIcon's getImage
result to a BufferedImage, store a reference to the BufferedImage for
later use in manipulations, and then set a JLabel's displayed icon to
this BufferedImage.  My assumption was this increase in size was due to
the image being represented or converted on the fly to a raster/bmp
image and not able to take advantage of JPEG's compression capabilities,
but the size difference is making my doubt myself.

Does this sound like a reasonable footprint to you?  Seems very heavy to
me.  I've re-explored my code and haven't idenitified a memory hole yet,
but I'm very concerned their may be one.

Thanks very much for your help!

John

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to