makeImageData function is not working for the large diagrams

Hi

I am try to generate a image base64string from the diagram. which has scale 2 and for the smaller diagrams it is generating but for the huge diagram it is not generating. it gets null from the makeImageData function

var img = mydiagram.makeImageData({
background: “white”,
scale: mydiagram.scale,
maxSize: new go.Size(Infinity, Infinity)
});

How large are the Diagram.documentBounds? Multiply the area by the square of the Diagram.scale times 4 bytes, and that is an approximation of how much memory will be needed.

That’s the danger of having a large maxSize, if you insist on trying to generate a raster image.

this are the document bounds for the diagram if it not scaled to 2
{x: -5, y: -5, width: 621.2144368682317, height: 51064.676331766306, Ga: true}

Is there any way to split this big image through API while exporting pdf or image ?

Read http://gojs.net/latest/intro/makingImages.html.

Or generate SVG: http://gojs.net/latest/intro/makingSVG.html

Hi @walter ,
I have a diagram which is 23000 * 12000. With a scale of 1 the callback returns null.
With a scale of 0.5 it works and the created image has a file size of ~2.5 MB.

Do I understand you correctly that the creation of the scaled image needs 23000 * 12000 * 4 * 0.5^2 = ~263 MB of memory?

If it is generating a bitmap image of 23000x12000, then I think the internal memory requirement is approximately 23000x12000x4 bytes. But it depends on exactly how you are calling it and how the browser implements it.

Note that such a memory usage also applies to whichever process loads the image, too.