[cairo] Large image support?

Ian Britten britten at caris.com
Wed Apr 1 05:15:08 PDT 2009


Hi all,
I was wondering what support, if any, Cairo might have for working
with large images?

I have two major (but distinct, I think) cases I need to address,
and am trying to figure out what I can leverage through Cairo, and
what I'll end up having to handle myself:

1) Rendering large images
    We can have lots of raster data to render, both in terms of
    large images, and/or many images to render.  Naively loading
    all the source pixels into Cairo image surface(s) and then
    asking Cairo to downsample to a particular size on the output
    surface will likely exceed the available memory.

2) Creating large images
    We have workflows where users need to generate very large
    high-res images (eg: 50000x50000 pixels).  Again in this case,
    simply trying to allocate a Cairo image surface that size will
    likely exceed the available memory.

I realize there's probably no simple silver-bullet solution to
these problems, and we'll have to do a lot on our end.  However,
I'd like to take advantage of whatever Cairo offers wherever
possible, rather than reinventing-the-wheel.  I still need/want
vector rendering (in addition to images), PDF output, and all
other stuff Cairo offers too...

For example, as a wacky idea for #1 - If all of Cairo could
access source pixels of an image via some sort of interface that
I could replace/extend (eg: image->getPixel(i,j)), then I could
maybe avoid loading the entire image at once, and just return
pixels as requested.  It'd be slow, but maybe would work for
large images.  Anyways, that's just an example/idea...

Similarly, if anyone out there is doing stuff like this, and has
any insight to offer, I'm open to any suggestions!
Many thanks for any info, pointers, etc!
Ian



More information about the cairo mailing list