RSS/Atom feed Twitter
Site is read-only, email is disabled

Code for editing in non-sRGB color spaces

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

10 of 10 messages available
Toggle history

Please log in to manage your subscriptions.

Code for editing in non-sRGB color spaces Elle Stone 06 Apr 09:43
  Code for editing in non-sRGB color spaces Elle Stone 06 Apr 19:26
   Code for editing in non-sRGB color spaces Elle Stone 06 Apr 20:48
    Code for editing in non-sRGB color spaces Elle Stone 09 Apr 20:32
     Code for editing in non-sRGB color spaces Sven Claussner 13 Apr 19:16
      Code for editing in non-sRGB color spaces Elle Stone 13 Apr 21:18
       Code for editing in non-sRGB color spaces Sven Claussner 14 Apr 03:53
        Code for editing in non-sRGB color spaces Elle Stone 15 Apr 15:14
        Code for editing in non-sRGB color spaces Elle Stone 21 Apr 11:10
       Code for editing in non-sRGB color spaces Elle Stone 16 Apr 14:40
Elle Stone
2016-04-06 09:43:56 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

I've been looking at the relevant babl/GEGL/GIMP code for enabling GIMP to edit in color spaces other than sRGB. Here are two questions:

1. Code for retrieving colorant information from an ICC RGB working space profile embedded in an image is already in https://github.com/GNOME/gimp/blob/master/libgimpcolor/gimpcolorprofile.c

Can the following babl functions from https://github.com/GNOME/babl/blob/master/babl/babl.h be used to send RGB colorant information (a 3x3 matrix) from GIMP to various babl functions that use Y and XYZ information?

/** * babl_set_user_data: (skip)
*
* associate a data pointer with a format/model, this data can be accessed and
* used from the conversion functions, encoding color profiles, palettes or * similar with the data, perhaps this should be made internal API, not * accesible at all from
*/
void babl_set_user_data (const Babl *babl, void *data);

/** * babl_get_user_data: (skip)
*
* Get data set with babl_set_user_data */
void * babl_get_user_data (const Babl *babl);

2. Instead of full-blown support for editing in all RGB working spaces, would it be easier and maybe even better to start with hard-coding into babl/GEGL/GIMP an assortment of commonly-used RGB working space chromaticities, including:

sRGB Rec.2020
ACEScg
ACES
AdobeRGB
ProPhotoRGB

and then pass a numerical identifier from GIMP to babl as the user switches from one image to another, so babl knows what chromaticities to use? This option of course would require that the user make an ICC profile conversion to one of the hard-coded RGB working spaces. But given the many ICC RGB profiles floating around that are not well-behaved and/or have odd TRCs, maybe this is the better option. Though support for "random RGB chromaticities" would be nice to eventually add in.

Best,
Elle

Elle Stone
2016-04-06 19:26:49 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

The question isn't how to get the nine RGB profile colorant values from GIMP. That's easy.

The question is given these nine floating point values, how to convey the values from GIMP to babl.

Best, Elle

Elle Stone
2016-04-06 20:48:23 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

On 04/06/2016 03:26 PM, Elle Stone wrote:

The question isn't how to get the nine RGB profile colorant values from GIMP. That's easy.

The question is given these nine floating point values, how to convey the values from GIMP to babl.

Like I said in my first post on this topic, the babl palette functions look like perhaps they could be used to ferry floating point values from GIMP to babl.

The following function placed inside babl's CIE.c (https://git.gnome.org/browse/babl/tree/extensions/CIE.c) does compile without errors:

void get_rgb (void) {
float rgbxyz[] = {
0.436, 0.385, 0.143,
0.222, 0.717, 0.061,
0.014, 0.097, 0.714
};

const Babl *rgb;
const Babl *rgba;
const Babl *format = rgb;

babl_new_palette ("mypalette", &rgb, NULL);

babl_palette_set_palette (format, babl_format ("RGB float"), rgbxyz, 3);

}

Palettes can be created in GIMP and then passed from GIMP to babl.

Once the matrix rgbxyz[] have been place inside a palette created in GIMP and then passed to babl, is there a way to retrieve the matrix from the palette for use as colorant values in CIE.c?

Best, Elle

Elle Stone
2016-04-09 20:32:09 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

I made the assumption that the very talented babl/GEGL/GIMP developers are capable of writing code that can send colorant information from GIMP to babl.

On the basis of this assumption, I made a list of all the code files in babl/GEGL/GIMP that would require patching: http://ninedegreesbelow.com/files/patch-gimp/user-chosen-rgb/hard-coded-srgb.ods

Then I wrote some "proof of concept" patches for providing GIMP users with the ability to edit in RGB working spaces other than sRGB: http://ninedegreesbelow.com/files/patch-gimp/user-chosen-rgb/proof-of-concept-patches.tar.gz

I also wrote an overview of the task of patching babl/GEGL/GIMP to allow for editing in a user-chosen RGB working space:

Modifying bab/GEGL/GIMP for editing in user-chosen RGB working spaces http://ninedegreesbelow.com/photography/gimp-edit-in-user-chosen-rgb-working-space.html

Best, Elle

Sven Claussner
2016-04-13 19:16:40 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

Hi Elle,

On 9.4.2016 at 10:32 PM Elle Stone wrote:

I made the assumption that the very talented babl/GEGL/GIMP developers are capable of writing code that can send colorant information from GIMP to babl.

On the basis of this assumption, I made a list of all the code files in babl/GEGL/GIMP that would require patching: http://ninedegreesbelow.com/files/patch-gimp/user-chosen-rgb/hard-coded-srgb.ods

Then I wrote some "proof of concept" patches for providing GIMP users with the ability to edit in RGB working spaces other than sRGB: http://ninedegreesbelow.com/files/patch-gimp/user-chosen-rgb/proof-of-concept-patches.tar.gz

I also wrote an overview of the task of patching babl/GEGL/GIMP to allow for editing in a user-chosen RGB working space:

Modifying bab/GEGL/GIMP for editing in user-chosen RGB working spaces http://ninedegreesbelow.com/photography/gimp-edit-in-user-chosen-rgb-working-space.html

thank you for your contribution and sorry for not replying earlier. I didn't have the time yet to read all your lines yet, but how about pushing your work to separate branches in babl, GEGL and GIMP? We could review and refine them there and make builds on Jenkins for testing. When they have matured for integration they should go then into the master branches.
If you need help with development let us know.

Greetings

Sven

Elle Stone
2016-04-13 21:18:20 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

On 04/13/2016 03:16 PM, Sven Claussner wrote:

Hi Elle,

Hi Sven,

On 9.4.2016 at 10:32 PM Elle Stone wrote:

I made the assumption that the very talented babl/GEGL/GIMP developers are capable of writing code that can send colorant information from GIMP to babl.

It took a bit of studying, but I figured out how to send colorant information from GIMP to babl using babl_get_user_data and babl_set_user_data.

On the basis of this assumption, I made a list of all the code files in babl/GEGL/GIMP that would require patching: http://ninedegreesbelow.com/files/patch-gimp/user-chosen-rgb/hard-coded-srgb.ods

The spreadsheet also lists locations of some problematic code that using hard-coded device parameters.

Then I wrote some "proof of concept" patches for providing GIMP users with the ability to edit in RGB working spaces other than sRGB: http://ninedegreesbelow.com/files/patch-gimp/user-chosen-rgb/proof-of-concept-patches.tar.gz

I'm preparing patches that are close to being actually useable instead of being merely "proof of concept". It will take a few more days of coding to finish.

thank you for your contribution and sorry for not replying earlier. I didn't have the time yet to read all your lines yet, but how about pushing your work to separate branches in babl, GEGL and GIMP?

Currently I don't have commit rights. But when I finish the new patches, it would be nice to be able to upload them to branches where people can test, review, etc.

We could review and refine them there and make builds on Jenkins for testing. When they have matured for integration they should go then into the master branches.

If you need help with development let us know.

Perhaps someone could set up suitable branches of babl/GEGL/GIMP?

Greetings

Sven

Best,
Elle

Sven Claussner
2016-04-14 03:53:32 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

Hi Elle,

On 13.4.2016 at 11:18 PM Elle Stone wrote:

On 04/13/2016 03:16 PM, Sven Claussner wrote:

thank you for your contribution and sorry for not replying earlier. I didn't have the time yet to read all your lines yet, but how about pushing your work to separate branches in babl, GEGL and GIMP?

Currently I don't have commit rights. But when I finish the new patches, it would be nice to be able to upload them to branches where people can test, review, etc.

We could review and refine them there and make builds on Jenkins for testing. When they have matured for integration they should go then into the master branches.

If you need help with development let us know.

Perhaps someone could set up suitable branches of babl/GEGL/GIMP?

It's best to set them up yourself, because even if we did you'd had to pull them and apply your patches there. Setting up branches is easy and perhaps you've already done it in your local workspace:

git checkout -b $mybranch

Instead of $mybranch use wip-not-only-sRGB or what fits best.

To get your branches upstream, follow this: https://wiki.gnome.org/Git/Developers#Pushing_your_changes_upstream

To get a GNOME Git account just follow this tutorial: https://wiki.gnome.org/action/show/AccountsTeam/NewAccounts?action=show&redirect=NewAccounts

In step 1 'Explanation why you think you should get an account' write that you need it to contribute to babl, GEGL and GIMP. I cc'ed to Mitch (or Pippin, too) so he can give his OK on admins request.

Greetings

Sven

Elle Stone
2016-04-15 15:14:47 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

On 04/13/2016 11:53 PM, Sven Claussner wrote:

Hi Elle,

Hi Sven,

On 13.4.2016 at 11:18 PM Elle Stone wrote:

On 04/13/2016 03:16 PM, Sven Claussner wrote:

Perhaps someone could set up suitable branches of babl/GEGL/GIMP?

To get a GNOME Git account just follow this tutorial: https://wiki.gnome.org/action/show/AccountsTeam/NewAccounts?action=show&redirect=NewAccounts

In step 1 'Explanation why you think you should get an account' write that you need it to contribute to babl, GEGL and GIMP. I cc'ed to Mitch (or Pippin, too) so he can give his OK on admins request.

Per your suggestion, I sent a request for a GNOME Git account and cc'ed Mitch and Pippin.

I've almost finished making a new set of patches. When the new patches are done I'll post them to
https://bugzilla.gnome.org/show_bug.cgi?id=737778.

Best, Elle

Elle Stone
2016-04-16 14:40:48 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

On 04/13/2016 05:18 PM, Elle Stone wrote:

I'm preparing patches that are close to being actually useable instead of being merely "proof of concept". It will take a few more days of coding to finish.

I attached the new patches to
https://bugzilla.gnome.org/show_bug.cgi?id=737778 and also updated "Modifying bab/GEGL/GIMP for editing in user-chosen RGB working spaces" (http://ninedegreesbelow.com/photography/gimp-edit-in-user-chosen-rgb-working-space.html).

The patches need a lot of testing. Some parts don't work yet. In particular:

* There needs to be code in GIMP that makes a new profile using the user's RGB profile's colorants and the sRGB TRC. GIMP already has code that makes a new profile using the user's RGB profile's colorants and the linear gamma TRC, but this code is only triggered when the user changes from "gamma" to "linear" precision.

* The decompose-to-LAB/LCH plug-in code doesn't produce the right results, though the LCH blend modes are correct and GEGL's saturation code works.

* Sometimes the switch between linear and gamma precision doesn't work correctly, though possibly I managed to fix this.

Best, Elle

Elle Stone
2016-04-21 11:10:37 UTC (almost 8 years ago)

Code for editing in non-sRGB color spaces

On 04/13/2016 11:53 PM, Sven Claussner wrote:

Hi Elle,

On 13.4.2016 at 11:18 PM Elle Stone wrote:

On 04/13/2016 03:16 PM, Sven Claussner wrote:

thank you for your contribution and sorry for not replying earlier. I didn't have the time yet to read all your lines yet, but how about pushing your work to separate branches in babl, GEGL and GIMP?

We could review and refine them there and make builds on Jenkins for testing. When they have matured for integration they should go then into the master branches.

If you need help with development let us know.

Perhaps someone could set up suitable branches of babl/GEGL/GIMP?

It's best to set them up yourself, because even if we did you'd had to pull them and apply your patches there.

To get a GNOME Git account just follow this tutorial: https://wiki.gnome.org/action/show/AccountsTeam/NewAccounts?action=show&redirect=NewAccounts

In step 1 'Explanation why you think you should get an account' write that you need it to contribute to babl, GEGL and GIMP. I cc'ed to Mitch (or Pippin, too) so he can give his OK on admins request.

I followed the GNOME Git account tutorial and now have a GNOME Git account that is approved for accessing GIMP. However, I don't see any mention of babl or GEGL. So I'm guessing that I can't set up "anyrgb" branches of babl/GEGL/GIMP for testing the code that I've written for editing using user-chosen colorants. But please let me know if I'm guessing incorrectly.

There has been a obvious lack of response to this thread and to my posts to https://bugzilla.gnome.org/show_bug.cgi?id=737778. So I'll just ask:

Is there any interest in allowing GIMP users to edit in color spaces other than sRGB? I mean for GIMP 2.10 rather than for "future GIMP"?

Best, Elle