Skip to main content

Accessing a large number of buffered images

2 replies [Last post]
byhisdeeds
Offline
Joined: 2006-01-06

I am sampling 128 x 128 points distributed across about 500 jpeg images (each 600x600) to create an image. This means that I must open these 500 files and read some RGB values at some x,y location with image.getRGB(x,y). I have a cache of the bufferedimage objects so that I don't need to re-create them too regularly. However the time to iterate through all the xy values is too long (>2 minutes) and I am running into memory problems when the cache holds more than 200 entries (~200MB used memory).

My current logic is:
1) lookup bufferedimage in cache. If found return bufferedimage.
2) create new bufferedimage for disk file.
3) add new bufferedimage to cache.
4) if number of entries in cache > max_cache_size remove least accessed cache entry.
5) return bufferedimage

My question is, can anyone tell me whether it would be faster and probably less memory exhaustive for me to replace the raster data in the bufferedimage object rather than create a new bufferedimage and ask the garbage collector reclaim the previous one. A sort of pool of bufferedimages to reuse. Also I am using ImageIO.read(...) to create the bufferedimages. Is this the fastest and best method.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Andreas Schildbach

Hello everyone,

I just read that there are now daily builds of JAI available. Would it
be possible to extend these daily builds to JAI-ImageIO?

Regards,

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Brian Burkhalter

Already happening:

https://jai-imageio.dev.java.net/#Downloads

Please test them and give us feedback and also mark any issues as "VERIFIED"
if appropriate.

Thanks,

Brian

On Sat, 18 Feb 2006, Andreas Schildbach wrote:

> Hello everyone,
>
> I just read that there are now daily builds of JAI available. Would it be
> possible to extend these daily builds to JAI-ImageIO?
>
> Regards,
>
> Andreas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net