[cairo] trouble with existing PNG in CAIRO_FORMAT_A8

Tristen Ennemuist tristen_e at yahoo.com
Thu Nov 3 22:24:16 PDT 2011


i'm having a spot of trouble with grayscale png images.

i can load png images using cairo_image_surface_create_from_png, but subsequent calls to cairo_image_surface_get_format never return CAIRO_FORMAT_A8, even when the original png format is actually CAIRO_FORMAT_A8. it seems to always automatically convert to CAIRO_FORMAT_RGB24, leaving me no way of knowing the original file format - that is as far as i can tell...

i don't really mind this automatic conversion behaviour (as i can extract the data from the surface any way i like), but, if i'm not mistaken, what's causing me the real trouble is not being able to detect if the image was originally grayscale or rgb.

is there some way i can go about detecting the original png file format?

(i tried using gdk_pixbuf_new_from_file and found that also automatically converts.)

regards and thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20111103/58fdbc79/attachment.htm>

More information about the cairo mailing list