File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes image manipulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "image manipulation" Watch "image manipulation" New topic

image manipulation

Dieter Merlin

Joined: Oct 25, 2005
Posts: 9

I have some code to create thumbnails of pictures anddisplay them on a site.
The problem is that we run into an outofmemoryerror every 2 weeks or so. (heap size = 512mb)

The average picture size is +- 1 MB

Here is the current code;

I know that the ImageIcon(byte[] data).getImage() holds a reference to the data but using Toolkit.createImage fails to work (black image)
and using doesnt help with the OOM either.

Avoiding the BAOS and writing the thumb directly to the ServletOutputStream causes 100% cpu usage and prevents the picture to be loaded.

I'm a little desperate on this since I cant find anything usefull that would help.

Thanks in advance
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

As the servlet API has no means of image manipulation, this has been moved to the AWT forum.

[Asking smart questions] [About Bear] [Books by Bear]
Dieter Merlin

Joined: Oct 25, 2005
Posts: 9
sorry, its just because we do it from a servlet in a jboss container that I thought it should be there, that it could have a meaning to it
I agree. Here's the link:
subject: image manipulation
It's not a secret anymore!