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

Adding a layer mode

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.

7 of 7 messages available
Toggle history

Please log in to manage your subscriptions.

Adding a layer mode "J 03 Mar 01:00
  Adding a layer mode Joao S. O. Bueno 03 Mar 02:14
   Adding a layer mode Jörn P. Meier 03 Mar 17:06
  Adding a layer mode Martin Nordholts 03 Mar 05:26
   Adding a layer mode "J 03 Mar 17:03
    Adding a layer mode Martin Nordholts 03 Mar 18:56
     Adding a layer mode "J 03 Mar 20:04
"J
2011-03-03 01:00:50 UTC (over 13 years ago)

Adding a layer mode

Hi,

I would like to implement the following layer mode in the GIMP:

1) Transform destination and source pixels to HSL space. 2) Note original destination pixel saturation. 3) Set luminance component of destination pixel to luminance component of source pixel.
4) Transform destination to HSV color space. 5) Set saturation of destination pixel to original saturation of destination pixel.

I'm assuming destination is also the result of the operation. Not sure how GIMP handles this, though.

The purpose of the mode is to colorize a greyscale image while keeping both the saturation and hue data of the color layer and the luminance data of the greyscale image. Existing modes (as far as I see) unfortunately either mess up the color information or the luminance information.

So, the question is, what changes would I need to make to add this layer mode?

I would be very grateful for any hints. :)

Cheers,

Jörn

Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Joao S. O. Bueno
2011-03-03 02:14:08 UTC (over 13 years ago)

Adding a layer mode

On Wed, Mar 2, 2011 at 10:00 PM, "Jörn P. Meier" wrote:

Hi,

I would like to implement the following layer mode in the GIMP:

1) Transform destination and source pixels to HSL space. 2) Note original destination pixel saturation. 3) Set luminance component of destination pixel to luminance component    of source pixel.
4) Transform destination to HSV color space. 5) Set saturation of destination pixel to original saturation of    destination pixel.

I'm assuming destination is also the result of the operation. Not sure how GIMP handles this, though.

The purpose of the mode is to colorize a greyscale image while keeping both the saturation and hue data of the color layer and the luminance data of the greyscale image. Existing modes (as far as I see) unfortunately either mess up the color information or the luminance information.

Hi John ---

regardless of the desired operation, it would be very difficult to stick a new layer operation in GIMP - due to file compatibilities, and everything else.

When I first started hacking around the GIMP source code, some years ago, new layer operations
also where something that I messed with.

But see..even if one doe shave a great idea, and a nice pacth taht wuld be included in the GIMP's source, there would be a problem of compatibility of new XCF images using the new layer mode, and older GIMP versions around.

So, while, yes, you could create a new layer mode just to poke around, it would be of little use other than for yourself. (Regardless, it is fun enough, I suggest you try it). If you get a usefull enough result, maybe yu could make a plug-in that would combine two normal layers using the algorithm you describe. You loose all real time niceness, but at least you can achieve your result. (and this plug-in can be passed around to others).

As for where to create a layer mode-- there are some files - -I don remember which now -- part of the fun is locating them -- you get to know yoru way around GIMP. You will even find out that there are different code paths to render layers on the source tree. There are all the files on the app/composite directory -- or one can enable GEGL compositing, for which the files are under app/gegl

This article can have some usefull hints on how to poke around GIMP' s source: http://www.ibm.com/developerworks/linux/library/os-gimp

Regards,

js ->

So, the question is, what changes would I need to make to add this layer mode?

I would be very grateful for any hints. :)

Cheers,

Jörn _______________________________________________ Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Martin Nordholts
2011-03-03 05:26:36 UTC (over 13 years ago)

Adding a layer mode

On 03/03/2011 02:00 AM, "Jörn P. Meier" wrote:

Hi,

I would like to implement the following layer mode in the GIMP:

1) Transform destination and source pixels to HSL space. 2) Note original destination pixel saturation. 3) Set luminance component of destination pixel to luminance component of source pixel.
4) Transform destination to HSV color space. 5) Set saturation of destination pixel to original saturation of destination pixel.

I'm assuming destination is also the result of the operation. Not sure how GIMP handles this, though.

The purpose of the mode is to colorize a greyscale image while keeping both the saturation and hue data of the color layer and the luminance data of the greyscale image. Existing modes (as far as I see) unfortunately either mess up the color information or the luminance information.

So, the question is, what changes would I need to make to add this layer mode?

I would be very grateful for any hints. :)

There is already a patch for that (using the CIELCH space instead), see the most recent patch in
https://bugzilla.gnome.org/show_bug.cgi?id=325564

/ Martin

My GIMP Blog:
http://www.chromecode.com/
"Why GIMP 2.8 is not released yet"
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
"J
2011-03-03 17:03:13 UTC (over 13 years ago)

Adding a layer mode

Hi Martin,

very cool. Is this a patch against the git version?

Cheers,

Jörn

On 03.03.2011 06:26, Martin Nordholts wrote:

On 03/03/2011 02:00 AM, "Jörn P. Meier" wrote:

Hi,

I would like to implement the following layer mode in the GIMP:

1) Transform destination and source pixels to HSL space. 2) Note original destination pixel saturation. 3) Set luminance component of destination pixel to luminance component of source pixel.
4) Transform destination to HSV color space. 5) Set saturation of destination pixel to original saturation of destination pixel.

I'm assuming destination is also the result of the operation. Not sure how GIMP handles this, though.

The purpose of the mode is to colorize a greyscale image while keeping both the saturation and hue data of the color layer and the luminance data of the greyscale image. Existing modes (as far as I see) unfortunately either mess up the color information or the luminance information.

So, the question is, what changes would I need to make to add this layer mode?

I would be very grateful for any hints. :)

There is already a patch for that (using the CIELCH space instead), see the most recent patch in
https://bugzilla.gnome.org/show_bug.cgi?id=325564

/ Martin

Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Jörn P. Meier
2011-03-03 17:06:26 UTC (over 13 years ago)

Adding a layer mode

Hi Joao,

thanks for the input!

Right now this would be only for me since my workflow somewhat depends on this mode.
I have already written an external implementation which is run from a script, but of course it would speed up things a lot if I had a realtime feedback on what the result will look like. :)

I might still take a look at the sources you mentioned. Maybe I'll learn something about how GIMP works. :)

Cheers,

Jörn

On 03.03.2011 03:14, Joao S. O. Bueno wrote:

On Wed, Mar 2, 2011 at 10:00 PM, "Jörn P. Meier" wrote:

Hi,

I would like to implement the following layer mode in the GIMP:

1) Transform destination and source pixels to HSL space. 2) Note original destination pixel saturation. 3) Set luminance component of destination pixel to luminance component of source pixel.
4) Transform destination to HSV color space. 5) Set saturation of destination pixel to original saturation of destination pixel.

I'm assuming destination is also the result of the operation. Not sure how GIMP handles this, though.

The purpose of the mode is to colorize a greyscale image while keeping both the saturation and hue data of the color layer and the luminance data of the greyscale image. Existing modes (as far as I see) unfortunately either mess up the color information or the luminance information.

Hi John ---

regardless of the desired operation, it would be very difficult to stick a new layer operation in GIMP - due to file compatibilities, and everything else.

When I first started hacking around the GIMP source code, some years ago, new layer operations
also where something that I messed with.

But see..even if one doe shave a great idea, and a nice pacth taht wuld be included in the GIMP's source, there would be a problem of compatibility of new XCF images using the new layer mode, and older GIMP versions around.

So, while, yes, you could create a new layer mode just to poke around, it would be of little use other than for yourself. (Regardless, it is fun enough, I suggest you try it). If you get a usefull enough result, maybe yu could make a plug-in that would combine two normal layers using the algorithm you describe. You loose all real time niceness, but at least you can achieve your result. (and this plug-in can be passed around to others).

As for where to create a layer mode-- there are some files - -I don remember which now -- part of the fun is locating them -- you get to know yoru way around GIMP. You will even find out that there are different code paths to render layers on the source tree. There are all the files on the app/composite directory -- or one can enable GEGL compositing, for which the files are under app/gegl

This article can have some usefull hints on how to poke around GIMP' s source: http://www.ibm.com/developerworks/linux/library/os-gimp

Regards,

js ->

So, the question is, what changes would I need to make to add this layer mode?

I would be very grateful for any hints. :)

Cheers,

Jörn _______________________________________________ Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Martin Nordholts
2011-03-03 18:56:00 UTC (over 13 years ago)

Adding a layer mode

On 03/03/2011 06:03 PM, "Jörn P. Meier" wrote:

very cool. Is this a patch against the git version?

Yes, and help with reviewing and testing it for inclusion in GIMP 2.8 would be appreciated.

/ Martin

My GIMP Blog:
http://www.chromecode.com/
"Why GIMP 2.8 is not released yet"
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
"J
2011-03-03 20:04:50 UTC (over 13 years ago)

Adding a layer mode

Compiling worked, but after clicking around a bit I persistently get

(gimp-2.7:27459): Gimp-Display-CRITICAL **: gimp_display_shell_pointer_ungrab: assertion `shell->pointer_grabbed == TRUE' failed
gimp_display_shell_pointer_grab: gdk_pointer_grab failed with status 1

and that's it.

Cheers,

Jörn

On 03.03.2011 19:56, Martin Nordholts wrote:

On 03/03/2011 06:03 PM, "Jörn P. Meier" wrote:

very cool. Is this a patch against the git version?

Yes, and help with reviewing and testing it for inclusion in GIMP 2.8 would be appreciated.

/ Martin

Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer