[cairo] Very Large PNGs
Frederik Ramm
frederik at remote.org
Wed Feb 16 08:53:03 PST 2011
Dear list,
I usually prefer rsvg over Inkscape when processing large SVGs but
today I was disappointed. I wanted to create a relatively large PNG file
from an SVG, and all I got from rsvg-convert was a zero-sized PNG, no
error message. (Ubuntu Jaunty.)
I found out that rsvg-convert tries to create an image surface but is
returned an invalid surface (where if you query the state it says "out
of memory"), happily ignores that and continues to "render" which then
results in no output.
I did prepare a patch for rsvg-convert to properly print an error
message - what would be the right place to send that to?
But my real point is, I then delved into the cairo library and found
that it uses pixman to create the image; and pixman refuses to create an
image that takes more than INT32_MAX raw bytes. With one pixel using 4
bytes, that means that an image with 23.000 x 23.000 pixels is still ok,
but if it becomes any larger, that was it.
Which was a bit sad for me since the machine I was running this on could
easily have created an image ten times as big, if only pixman/cairo had
supported that.
I briefly toyed with adding 64-bit support to the whole bundle but it
became quickly apparent that this is more than an afternoon's job. I
also tried to squeeze at least a little more out of the combo by using
24-bit images instead of 32-bit (no difference since 24-bit images are
internally stored with 32 bit), and even the deprecated 16-bit data type
(doesn't work since you cannot create a surface for that).
I resorted to dicing my image into smaller chunks but that caused
considerable manual work.
What do others do when they want to create large PNGs? Has someone
perhaps already been working on large image support in pixman/cairo?
Would it be welcome if I tried my hand at this? Or is everyone using
other SVG renderers for large images - if so, which?
Bye
Frederik
More information about the cairo
mailing list