Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Memory efficient exporting for large background images (5000x25000 pixels)

0 votes
I have a large background image I want to export to a .pdf. I get a heap space exception when I try to export the whole thing and even when I clip the export to a small visible region. The image file is a 1MB large .gif file and about 5000x25000 pixels. It seems like I should be able to export something that small without running into memory problems.
asked Jul 12 in Feature Requests by anonymous

1 Answer

0 votes

The file size of an image file does not really matter with regards to the amount of memory required for processing and displaying said image because raster image file formats usually store the image data in a compressed way. What does matter when processing and displaying an image is the actual image dimensions. And 5000px by 25000px is large - an image of that size uses up approximately 480MB of memory while being processed/displayed. Moreover, when embedding a raster image into a PDF document, the image is not necessarily embedded in a compressed way either. Thus embedding an image of this size may well result in a very large PDF document as well.

answered Jul 13 by thomas.behr [yWorks] (98,370 points)
Thank you, Thomas. I was afraid that was the case. Sadly, even after increasing the maximum memory available to yEd to 1500MB with the -J-Xmx1500m option, I still get an out of memory error when exporting to PDF. Perhaps there is some problem with the way my company manages settings in the operating system that is preventing yEd from getting the memory it needs.

It's ok if the PDF is large, but the exporting step causes an out of memory error. It is too bad that the image file must be loaded into memory all at once, rather than reading and writing a few rows of pixels at a time.

Also, if the entire image wasn't loaded at once, the export to .gif from yEd would then result in a small (~1MB) file. I suppose the underlying image libraries cannot be changed though.