`makeImageData` performance issues on Electron/Vue3

Hello,

We’re using makeImageData to generate image previews of our diagrams in an Electron app using Vue 3. However, when our diagrams start having a few tens of nodes, the following line of code:

const img = this.DIAGRAM.makeImageData({
    scale: 0.8,
    maxSize: new go.Size(40000, 40000),
    type: 'image/webp',
    details: 0.6
});

begins to take an excessively long time to execute—on the order of several seconds in some cases. This causes noticeable UI freezes and impacts user experience.

Due to a few interconnected dependencies, we’re currently stuck on version 2.3.12 (although a separate dev is working on updating to the latest version, which may not happen for a while).

Is there an alternative approach or an asynchronous function to achieve the same result without blocking the main thread?

Thanks a lot

By overriding the default maximum image size, do you realize how much memory might be required to produce such a large raster image? That’s 6.4 Billion bytes. If you don’t want to break it up into reasonably sized images, I suggest that you render it to SVG, by calling Diagram.makeSvg.