Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Exporting diagram as Image file leads to Out of Memory Error (Read 4475 times)
Gaurav Dubey
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Sep 28th, 2016
Exporting diagram as Image file leads to Out of Memory Error
Oct 27th, 2017 at 1:25pm
Print Post  
We have requirement of exporting Diagram to Image file(jpeg,png and gif), However doing this cause out of memory exception.

Reason could be image have high resolutions(22348x4282) pixels.

I am using diagram.createImage( BufferedImage.TYPE_INT_RGB) method to create image and writing it using ImageIO.write api.

Is there any better way to do the same to overcome out ot memory error while writing image in file?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: Exporting diagram as Image file leads to Out of Memory Error
Reply #1 - Oct 27th, 2017 at 1:49pm
Print Post  
Is createImage itself throwing memory exception or ImageIO.write?
  
Back to top
 
IP Logged
 
Gaurav Dubey
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Sep 28th, 2016
Re: Exporting diagram as Image file leads to Out of Memory Error
Reply #2 - Dec 21st, 2017 at 7:29am
Print Post  
ImageIO.write because if components are in good amount in diagram, then image size is more than 7 to 10 MB or so, and i could not find a way to create image with less resolution.

So due to size of image, application crashes while using ImageIO.write.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: Exporting diagram as Image file leads to Out of Memory Error
Reply #3 - Dec 21st, 2017 at 10:38am
Print Post  
We don't plan writing low-level image encoding code at this time. Try splitting the produced image into smaller ones in memory, write them into separate files, and use external tool to glue them in a large file. E.g. try ImageMagick / JMagick -
https://www.imagemagick.org/script/index.php
https://www.imagemagick.org/discourse-server/viewtopic.php?t=11320

If you are on older Java version, you might also check if latest JRE9 is able to serialize larger images.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint