Forums Register Login

What does the memory usage of loading PNG file depend on?

+Pie Number of slices to send: Send
If I load a PNG picture, the picture is 1000 x 1000, but I didn't use much colors, so the size of the file is SMALL, but the dimension of the picture is large. Will the memory usage of load the picture big (because the 1000 x 1000 dimension) or small (because the size of the file)???
Thanks in advance

Yours Sincerely
Olnex
+Pie Number of slices to send: Send
I'm not sure, but I'd think the image in memory should require the same amount of memory when in-process as it does when sitting on the file system because Java won't do any sort of compression or anything -- and you wouldn't want it to anyway, because who know how that's working and how it might affect the image. So, if, on the file system it is 10k, then it will require 10k in memory. PNG is a compressed image already anyway. The java.io classes may only read in as much as is needed at a give time, so your memory footprint my be kept small, but once you read the whole thing in to do any sort of operation on it, the whole thing will need to be in memory somewhere.

Read up some on JAI (Java Advanced Imaging api) and the Java 2D api's, they should give clarification.

http://java.sun.com/products/java-media/jai/index.jsp
http://java.sun.com/products/java-media/2D/index.jsp

Hope this helps.
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 925 times.
Similar Threads
OutOfMemoryError
Swing: getting scrollpanel to behave correctly
Memory leaks in GUI programs
Why Velocity Templates takes larger memory JIRA
getting picture into netbeans
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:22:26.