Pasi Paasiala wrote:
Hello all,
Even though this is not strictly a Java3D question I think there might
be people who know or are interested in this question. Sorry for the rest.
In our application we are taking snapshots from Canvas3D and we
maintain them as BufferedImages in the memory. I have found out that
each image takes quite a lot of memory and when we save the images
during serialization as pixels, the file size is enourmous. I'm also
sure that these pixels contain lots of redundancy and they could
easily be compressed. So I have two questions:
What is an economic format to store an image in the memory while it's
not being displayed?
How can I compress the image when it is being serialized?
Somebody might say that I could compress my whole serialized file, but
I'd rather not start from that, since it might hide other problems
under the carpet.
Thanks,
Pasi
I'm not sure about the memory store, but as to file storage..
I've recently done a similar thing while generating a whole bunch of
specific textures for a landscape. Storing the textures in raw format
gave me a 22MB file. Using javax.imageio I've stored the textures within
the files as either PNG or JPG (controllable) and reduced the file to
11MB and 1.3MB respectively. There are plenty of tutorials on how to use
javax.imageio to write images out to a stream.
I suppose where memory is concerned the more primitive the store the
better. Maybe a PixelGrabber grabbing the image into an int array would
be best. Just hold onto the int array. If you wanted to compress this in
memory you could take Brad's suggestion.. This way you could compress
the image primitive into a byte array and hold that in memory instead.
You would of course have to decompress it when every time you wanted to
use it. I'd avoid using the standard impl of the ObjectOutputStream
though, since this adds quite a bit of stuff describing the object.
Kev
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".