[cairo] Gray-scale support in Cairo

Behdad Esfahbod behdad at behdad.org
Thu Sep 24 08:35:01 UTC 2020

The second approach is what you are expected to use. I agree it feels

On Thu, Sep 24, 2020, 2:13 AM <t_list at mailbox.org> wrote:

> Hello there,
> I am dealing with large TIFF files of planetary data which are mostly
> gray-scale. I noticed that the cairo image format [0] does not define an
> 8-bit gray-scale format. The closest to this would be the 'A8' however,
> this is made for alpha values.
> Since cairo is around for quite some time, I suppose there is a way to
> deal with gray-scale images, so I wonder what the recommended way is.
> Right now to make this work I can either save each pixel value three
> times, or use the A8 format and put a white background behind the image.
> The first workaround is sub-optimal because it results in a huge waste of
> memory and additional compute time and mind you I am dealing with huge
> image data.
> The second approach kinda works but it feels like a hacky solution
> nonetheless and might cause other rendering problems.
> As a little side-note: I am not using cairo directly but rely on the cairo
> bindings for Rust (cairo-rs) since my application is written in Rust.
> Any help how to deal with this, would be much appreciated.
> [0]:
> https://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t
> - Raphael
> --
> cairo mailing list
> cairo at cairographics.org
> https://lists.cairographics.org/mailman/listinfo/cairo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20200924/5766aebe/attachment.htm>

More information about the cairo mailing list