Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 140291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:35:18+00:00 2026-05-11T07:35:18+00:00

I have to render a very big image (>50.000² pixel) with cairo. To do

  • 0

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.

  1. Create 1000×1000 Surface
  2. Translate to position of the current part
  3. Draw image (calling the drawing instructions using pycairo)
  4. Render/Save image to file (cairo_surface_write_to_png)
  5. Repeat with next part

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?

  1. Create 1000×1000 Surface
  2. Draw image
  3. Move everything to position of the current part
  4. Render/Save image to file
  5. Repeat 3 with next part

or

  1. Create 50000×50000 Surface
  2. Draw image
  3. Render/Save only the current part of the image to file
  4. Repeat 3 with next part
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:35:18+00:00Added an answer on May 11, 2026 at 7:35 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom NSActionCell used to render some parts of some of the
I have some very simple xml and xslt documents, which render in IE8 in
I'm trying to use mustache templates to render very simple forms, however, one of
I have very little experience in web development, so this may be a very
I realize that this is probably a very basic question, but I have spent
I have this quite big CSV file (15 Gb) and I need to read
I have a very hard-coded XML reader below: using System; using System.Collections.Generic; using System.Linq;
So in my base template, I have: {% render EcsCrmBundle:Module:checkClock %} Then I created
I have to render some text to a web page. The text is coming
When I have to render textarea content to the front end I usually pass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.