[cairo] Large image support?

Ian Britten britten at caris.com
Wed Apr 1 09:48:48 PDT 2009

M Joonas Pihlaja wrote:
>> I was wondering what support, if any, Cairo might have for working
>> with large images?

>> 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.

> I expect you'll need to to do some sort of external mip-mapping style 
> solution for this case.

Thanks.  I was figuring that I'll likely have to handle these images
myself somehow.  Since I don't have anything for doing this handy
(And am not currently familiar with the techniques), I was hoping to
maybe leverage Cairos existing stuff.

One thing I was wondering:
Can I downsample a huge image in a tiled way and stitch the
downsampled tiles back together into one reasonable size image, or
would that result in visible artifacts at the edges of each tile?
(Or some other problem?  As I said, I'm not too familiar with
image processing/downsampling details)

>> 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.

> Again, tile based approaches rule here.  If some of your path geometry 
> is particularly local, then it might make sense to stuff them in a 
> spatial index so that you only render that geometry which is visible.  
> Similarly if it's very non-local then figuring out quickly whether the 
> entire tile is going to be covered by some geometry can be done with a 
> spatial index filter.  Depending on your geometry, both can be big 
> wins.

Thanks.  We already make heavy use of spatial indicies (Multiple
levels of multiple indicies actually!) to handle our volume of data.
As for the tiling approach, see my other reply (To Simon) for some

Thanks for the info!

More information about the cairo mailing list