I have to render a very big image (>50.000² pixel) with cairo. To do this without running out of memory I render parts of the image (<1.000² pixel) one after another and merge them together later.
Because cairos clipping algorithms are faster than my own, step three draws the whole image, even if only a part of it is visible. Most of the CPU is used in Step 3 (by python). Most of the memory is used in Step 4 (by cairo).
Is there a way to speed things up? Something like this?
or
First of all, using C or Vala instead of Python will probably speed things up.
As for memory usage, I would try writing to my own stream, rather than a file (see write_to_png_stream). This could allow you to (I didn't try this) control memory usage, assuming Cairo doesn't call your function only once after everything's done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With