Java ImageIO.write() takes up to 6 seconds

感情迁移 提交于 2019-11-29 17:01:19

Image encoding in java is pretty slow in general but you may also want to ensure you have the native libraries installed as they make quite a noticeable difference in performance.

http://download.java.net/media/jai-imageio/builds/release/1.1/INSTALL-jai_imageio.html

Are you sure that the

ImageIO

takes so long - maybe there is another problem, e.g.

  • slow (network) connection to the client
  • the generation (calculation) of the image takes a lot of time

Be aware that ImageIO by default uses temporary files as cache when creating ImageInputStreams and ImageOutputStreams. This can be switched off by calling ImageIO.setUseCache(false).

For a more detailed explanation see this answer.

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