• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
HaoZhe Xu
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
M Anderson
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!