[Gegl-developer] Is gegl_buffer_* aware of source color profile?
- From: <marcodv seznam cz>
- To: <gegl-developer-list gnome org>
- Subject: [Gegl-developer] Is gegl_buffer_* aware of source color profile?
- Date: Tue, 21 Jan 2020 09:37:31 +0100 (CET)
For example, let's say I'm developing a gimp plugin and I'm using gegl_buffer_iterator_* to get the data. And
I want to manipulate the data in profile connection space CIE xyY. I have:
```
...
GeglBuffer *buffer;
const Babl *format;
GeglBufferIterator *iter;
buffer = gimp_drawable_get_buffer(drawable_ID);
format = babl_format("CIE xyY float");
iter = gegl_buffer_iterator_new(buffer,
..., ...,
format,
..., ..., ...);
while (gegl_buffer_iterator_next(iter))
{
...
```.
And this seems to work fine if the color profile in gimp is set to sRGB. for example, with pure sRGB green
(#00ff00), the gegl_buffer will get me xyY 0.32, 0.58, 0.72, which seems about right.
The problem becomes when I convert the image in gimp to something like ProPhoto. Gimp correctly converts the
pure green to be represented with something like ProPhotoRGB #8aed4e, which is probably still around the same
green as before in profile connection space. So far, so good.
But then, when I try to read this drawable with gegl_buffer:
```
...
GeglBuffer *buffer;
const Babl *format;
const Babl *profile = babl_space("ProPhoto");
GeglBufferIterator *iter;
buffer = gimp_drawable_get_buffer(drawable_ID);
format = babl_format_with_space("CIE xyY float", profile);
iter = gegl_buffer_iterator_new(buffer,
..., ...,
format,
..., ..., ...);
while (gegl_buffer_iterator_next(iter))
{
...
```,
I get xyY 0.36 0.51 0.67, which differs from before. xyY should be agnostic to the color space as it is a
profile connection space. It's almost as if the gegl_buffer interpreted the #8aed4e color as sRGB and not as
ProPhotoRGB, which then kinda matches the result.
Is there a way for gegl_buffer to interpret the drawable data using the correct color space? Is there a
libgimp way to get the assigned image profile to use it with gegl? Or is it better to load the buffer with
something like babl_format("RGB float") and then use babl_fish() to manually convert to xyY?
Thanks
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]