How much memory will java.awt.Image consume if JPEG is 10MB?

眉间皱痕 提交于 2019-12-14 03:59:29

问题


MTOM is usually used to transfer image data over SOAP (attachments). The image is mapped to a java.awt.Image (at least with CXF). Does the Image object consume a lot more memory than the actual image transferred? Let's say a transferred JPEG is 10MB, how much more space will the Image object consume?

  • UPDATE - I'm not so sure it has anything to do with java.awt.Image at all. Focusing on CXF/MTOM more at the moment: http://cxf.547215.n5.nabble.com/MTOM-large-attachments-eating-up-JVM-heap-td5714196.html

回答1:


Does the Image object consume a lot more memory than the actual image transferred?

Typically yes. The idea of most of the file formats is to compress image data.

Let's say a transferred JPEG is 10MB, how much more space will the Image object consume?

The RAM size depends on W * H * 'pixel depth'. E.G. RGBA in 256 shades is 4 bytes per pixel. JPEG does not support alpha transparency, so it would be 3 bytes per pixel.


For some idea of the effectiveness of JPEG compression efficiency at different levels, see this answer:



来源:https://stackoverflow.com/questions/12489009/how-much-memory-will-java-awt-image-consume-if-jpeg-is-10mb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!