[cairo] Saving Deep Images As PNG?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Wed Mar 11 21:03:59 PDT 2015


Looking at src/cairo-png.c, if the ImageSurface format is
CAIRO_FORMAT_RGB30, then it sets bpc (bits per component) to 10. This
value is then passed as the bit_depth argument to png_set_IHDR. However,
according to the libpng docs
<http://libpng.org/pub/png/libpng-manual.txt>, valid values for this
argument are 1, 2, 4, 8 or 16, depending on the color_type.

I think the value of 10 is being silently truncated or rounded to 8, so
the result PNG file only ends up with 8 bits per component. Certainly I
cannot see any signs of component depths greater than 8 when I try
examining the file with “identify --verbose”.


More information about the cairo mailing list