<div dir="auto">The second approach is what you are expected to use. I agree it feels hacky. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 24, 2020, 2:13 AM <<a href="mailto:t_list@mailbox.org">t_list@mailbox.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
Hello there,
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
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.
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
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.
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
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.
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
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.
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
The second approach kinda works but it feels like a hacky solution nonetheless and might cause other rendering problems.
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
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.
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
Any help how to deal with this, would be much appreciated.
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
[0]: <a href="https://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t" target="_blank" rel="noreferrer">https://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t</a>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
<br>
</div>
<div style="font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:#ffffff">
- Raphael
<br>
</div>
</div>
</div>
-- <br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank" rel="noreferrer">cairo@cairographics.org</a><br>
<a href="https://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer noreferrer" target="_blank">https://lists.cairographics.org/mailman/listinfo/cairo</a><br>
</blockquote></div>