It is currently Thu Jul 04, 2024 4:54 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 18 posts ] 
Author Message
 Post subject: Saturation H M L plug-in
PostPosted: Thu Oct 28, 2021 10:12 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
I have eventually produced a plug-in that others might find useful!
It creates three masked layers of different saturations, high, medium, and low. These allow largely independent adjustment of the saturation of the three layers.
I have frozen the undo stack to speed-up the operation and reduce memory usage.

It would be good to be able to undo the script with a "ctrl-z" and merge the layers with a key-press on completion, but this is way beyond my capability!

The only slight problem - when I run the script from the terminal, I get the error message "EEEEeEeek! 1 GeglBuffers leaked". I don't know if this is significant and I have been unable to find the source of the error.

Any comments, criticism, and advice are most welcome.

Attachment:
saturation_h_m_l.zip [2.54 KiB]
Downloaded 53 times


Attachment:
saturation_h_m_l_tut.zip [51.15 KiB]
Downloaded 69 times


Edit: The files have been updated to allow them to work with other languages. 29/10/2021.
Edit: Updated to latest version of plug-in - corrected error in script.
Edit: File updated to version 4 with options to select transition between masked layers.


Last edited by david on Thu Nov 04, 2021 6:04 am, edited 3 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Thu Oct 28, 2021 10:56 am  (#2) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
I tested an it's not giving any errors. There is no changes in the color of the image. The only thing that each layer with a mask does, it create a different Transparency in each one.

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Thu Oct 28, 2021 11:26 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
Thanks for the reply.

The error only appears in the terminal.

By selecting a layer, the saturation of that layer can be adjusted using Colours/Saturation, without a substantial effect on the other two layers. This makes it possible to change the saturation in each of the three regions independently.

Perhaps I wasn't clear in my description.


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Thu Oct 28, 2021 12:14 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Hi David.

A strange story.
It works in the English and French versions of Gimp.
It does not work in Italian and Polish. :gaah


Attachments:
HML2.jpg
HML2.jpg [ 23.53 KiB | Viewed 2465 times ]
HML1.jpg
HML1.jpg [ 92.47 KiB | Viewed 2465 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Thu Oct 28, 2021 2:00 pm  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
Possibly due to "saturation_layer = pdb.gimp_image_get_layer_by_name(decomposed_image, 'saturation')" that will only work in some languages.

@david what is likely the same everywhere is the stack order, so instead of using names you can use "image.layers[position]" once you have figured out which of H, S, V correspond to 0, 1, 2.

_________________
Image


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Thu Oct 28, 2021 2:26 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
ofnuts to the rescue as always!!!

I just reached the same conclusion while lying in the bath. Would you call that an Archimedes moment?

At the moment it decomposes to separate images, so all three are layer zero. So I will have to change it to decompose to layers and then saturation will be layer 1.

Edit: A quick look in a translate program shows that perhaps English and French are the only languages where it is the same.


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Fri Oct 29, 2021 4:52 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
@MareroQ,
Thanks for your reply. I had not considered the language implications of getting images and layers by name. I made this plug-in for my own use (with much help from Tin Tran) and thought it may be useful for other people.

@ofnuts,
After more thought, I don't believe I can find a solution to the language problem. I could change a line to:

saturation_layer = image.add_layer(layer, 0) (Is this syntax correct?)

However, in the decompose image command it seems that the only way of using it is to specify "HSV". This will surely change depending what language is used. If there were alternative tokens/numbers for the various decompose-type it may be possible

At this point I have decided to give up on GIMP Python - I waste so many hours trying things and searching the internet for working examples!


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Fri Oct 29, 2021 10:32 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Hi David.

The Ofnuts solution works.
When do You exchange (on line 66) with:
saturation_layer = pdb.gimp_image_get_layer_by_name(decomposed_image, 'saturation')

on:
saturation_layer = image.layers[1]


David - Thanks for the very useful plugin. :bigthup
I am asking for more. :yes
I was confused too - but we have some smart coders. :clap :clap :clap

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Fri Oct 29, 2021 10:59 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
MareroQ,

I am pleased that the plug-in now works and I hope it will be useful to you.

However, it still leaves me confused. The decompose statement at line 62 gets an image by name "HSV" and I find it strange that the abbreviation for Hue, Saturation & Value would remain the same in other languages.

Thanks for your help.

Edit: Files in #1 updated. 29/10/2021


Last edited by david on Fri Oct 29, 2021 11:32 am, edited 1 time in total.

Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Fri Oct 29, 2021 11:13 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
I did a test first - changed 'saturation' to 'nasycenie' - and it started working.
So HSV is immutable input - and GIMP is so smart that it translates the output names into different (appropriate) languages.
I learned so much today. :lol

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Fri Oct 29, 2021 12:00 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
MareroQ,

Thanks for your help. I have updated the files in entry #1 of this thread.

Out of curiosity, if you look at decompose in the procedure browser, in either the Polish or Italian versions of GIMP, does it show the English version - HSV - or is it translated?


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Fri Oct 29, 2021 12:32 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Python Procedure Browser is translated to a very limited extent.


Attachments:
PPB.jpg
PPB.jpg [ 135.61 KiB | Viewed 2017 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Fri Oct 29, 2021 12:45 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
Thank you for that, it resolves my confusion!!!


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Sat Oct 30, 2021 5:38 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
Apologies! I have had to correct the script. The latest change (line 73) was indexing the incorrect image.
Thanks to Krikor for finding the error.
I have checked with numerous photographs this morning and hopefully it is now OK.
The file at #1 of this thread has been updated.


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Tue Nov 02, 2021 10:42 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
I have been experimenting with this plug-in. The version in #1 of this thread has a soft transition (overlap) between the high, medium and low saturation regions.
Having tried varying the amount of overlap on numerous photographs, I am undecided as to the best degree of overlap. So I have produced a version which gives a choice of three different transitions which I hope people will try and then give me feedback in order to make a plug-in which is of the greatest use.

The amount of overlap is infinitely variable by changing the curves which create the three regions (overall and within the individual regions).

I look forward to some comments, criticism and suggestions!

Attachment:
saturation_h_m_l_trial.zip [2.21 KiB]
Downloaded 40 times


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Wed Nov 03, 2021 3:33 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Hi David.

My preference is usually Soft - but it's very nice to have additional options now. Thanks for that. :bigthup
On minor matters: a bit of description, change of location in the (Colors) menu, NORMAL_MODE mode (works, but actually doesn't exist anymore). ;)


Attachments:
Example Info.png
Example Info.png [ 8.39 KiB | Viewed 1852 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Wed Nov 03, 2021 5:30 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
MareroQ.

I have tried the plug-in on numerous photographs. While "soft" (the same as the original) works well on some pictures, I found that on others there was too much overlap between the different regions. I was hoping to find a compromise, hence the trial version. I think that the options menu of this version may be adding unnecessary complication to the plug-in.

As always, your opinion is appreciated.


Top
 Post subject: Re: Saturation H M L plug-in
PostPosted: Thu Nov 04, 2021 6:09 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Nov 15, 2014
Posts: 866
The general opinion is that it is useful for certain images to be able to select the transition between the masked layers. So I have updated the file in #1 of this thread to Version 4.

Any suggestions to improve this plug-in are always welcome.


Top
Post new topic Reply to topic  [ 18 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Getting Black from Hue/Saturation

1

No new posts Attachment(s) GEGL Vibrance - fancy saturation plugin (probably canceled)

8

No new posts Attachment(s) Don't work procedures plug-in-bump-map, plug-in-displace

2

No new posts Attachment(s) I need help about ofn-plug-ins

19

No new posts Attachment(s) Gimpscripter plug in for 2.10?

4



* Login  



Powered by phpBB3 © phpBB Group