Hi. It was discussed[0] that it's quite a pity for many applications that cairo doesn't allow setting any options for the generated PNG. Please add an API, which allows that, including e.g.: - compression level - progressive PNP or not - comments - gamma, background, color - etc. pp. (see what libpng or GIMP offers) Cheers, Chris. [0] https://lists.oetiker.ch/pipermail/rrd-users/2012-August/018803.html
If you want more control over the generated PNG, use libpng directly. The reason can be found in the documentation: The PNG functions allow reading PNG images into image surfaces, and writing any surface to a PNG file. It is a toy API. It only offers very simple support for reading and writing PNG files, which is sufficient for testing and demonstration purposes. Applications which need more control over the generated PNG file should access the pixel data directly, using cairo_image_surface_get_data() or a backend-specific access function, and process it with another library, e.g. gdk-pixbuf or libpng. Cairo doesn't try to be a general purpose image loading/saving library and thus the API you propose doesn't fit into cairo.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.