[Pixman] Very Large PNGs
frederik at remote.org
Wed Feb 23 03:34:57 PST 2011
I posted this to the cairo list but it occurred to me that this list
is the appropriate place.
I tried to convert an SVG file to a very large PNG with rsvg-convert.
If the bitmap requested is larger than about 23k x 23k pixels, it 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 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
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?
More information about the Pixman