[cairo] Cairo & libpng/zlib parameters

Jeroen van Rijn jvrnix at gmail.com
Sat Jan 16 13:18:27 PST 2010


Hi all,

In the maposmatic.org project, Cairo is employed by way of PyCairo to
render city maps from OpenStreetMap data using Mapnik. I'm currently
investigating the possibility of running optipng after the rendering
is complete to reduce the size of the output file, see [1]. So far
I've identified a number of zlib parameters and png filter range that
appear to be the sweet spot for this type of image as far as file size
goes.

In doing this it suddenly occurred to me that it might be possible -
rather than apply optipng as a secondary stage - to direct Cairo to
directly output a png file with the zlib and libpng parameters
mentioned.

My question to you is: Is there an optional parameter to give PyCairo
or Cairo itself to select a certain png optimization strategy? e.g.
surface.write_to_png(output_filename, zlib = 'zm=9,zc=9', libpng =
'f:1-5')

Thanks in advance for taking the time to answer.

Best regards,
Jeroen van Rijn

[1] https://savannah.nongnu.org/task/?9917

-- 
"That's like saying that a squirrel is 48% juicier than an orange -
maybe it's true, but anybody who puts the two in a blender to compare
them is kind of sick." -- Linus Torvalds


More information about the cairo mailing list