- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.Scheduling library for HTML5 & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Exporting diagram as Image file leads to Out of Memory Error
Read 335 times

Gaurav Dubey   Offline
YaBB Newbies
*
Posts: 8
I Love MindFusion!


   
     
 
Exporting diagram as Image file leads to Out of Memory Error
Oct 27th, 2017 at 2:25pm
 
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?
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1436
Gender: male
tech.support


   
     
 
Re: Exporting diagram as Image file leads to Out of Memory Error
Reply #1 - Oct 27th, 2017 at 2:49pm
 
Is createImage itself throwing memory exception or ImageIO.write?
 
 
 
IP Logged    
 
     

Gaurav Dubey   Offline
YaBB Newbies
*
Posts: 8
I Love MindFusion!


   
     
 
Re: Exporting diagram as Image file leads to Out of Memory Error
Reply #2 - Dec 21st, 2017 at 7:29am
 
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.
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1436
Gender: male
tech.support


   
     
 
Re: Exporting diagram as Image file leads to Out of Memory Error
Reply #3 - Dec 21st, 2017 at 10:38am
 
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.
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print