[cairo] Saving surfaces as GIF/ low color PNG

Mohit Sindhwani tech at onghu.com
Thu Aug 14 07:40:22 PDT 2008

Simon Budig wrote:
> Mohit Sindhwani (tech at onghu.com) wrote:
>> For one of the applications where we are serving up dynamically created 
>> images on the web, I was thinking of using Cairo.  Now, Cairo produces 
>> PNG files, which at default can be quite large.  I was wondering if 
>> people here are using something to convert the image/ PNG surface to a 
>> GIF file or such.  I'm on Windows for this application.
> (just a sidenote - if saving the *same* image content PNGs are basically
> always smaller than GIFs.)
> When using cairo_image_surface_create() you are not limited to the PNG
> format. Cairo has some convenience functions to write an image surface
> to PNG, but you can also get the image data directly via
> cairo_image_surface_get_data(). Then you can throw any library functions
> at this data, e.g. encoding as JPEG/GIF/PNG (via libpng) or whatever.
> That should suit your needs.
> Bye,
>         Simon

Thanks Simon - it gives me the pointers to get started!

8/14/2008 | 10:40 PM.

More information about the cairo mailing list