Sat Jan 27, 2024 12:27 am
teapot wrote:I'm on an old version of 2.10 and my GimpCurvesConfig.settings has lines:
(linear no)
which Ofnuts script is also expecting.
However Tim has taken it out as the, presumably later version, file on post #13 doesn't have them.
...
Sat Jan 27, 2024 12:50 am
settings=load("C:\\Users\\diego\\Desktop\\Gimp-2.10.36_Portable_32-64bit-Win\\Preferences\\filters\\GimpCurvesConfig.settings")
Sat Jan 27, 2024 1:14 am
dinasset wrote:teapot wrote:I'm on an old version of 2.10 and my GimpCurvesConfig.settings has lines:
(linear no)
which Ofnuts script is also expecting.
However Tim has taken it out as the, presumably later version, file on post #13 doesn't have them.
...
I think that the "linear no" is added after having been used interactively, I see it now in my config file
I attach the zipped file after having used it online (the first now is "the klast used")
# nameLine,timeLine,linearLine=islice(settingsFile,3)
nameLine,timeLine=islice(settingsFile,2)
nameLine,timeLine,linearLine=islice(settingsFile,3)
Sat Jan 27, 2024 2:55 am
Sat Jan 27, 2024 3:12 am
Sat Jan 27, 2024 5:22 am
dinasset wrote:Sorry Tin and Ofnuts.
- if I copy what you posted (included ofnuts' suggested change) I get a list of messages, but nothing else
- whatever I add in the code, for instance create a new layer, it is executed but then no more filter messages but an error
As long as my little brain does not see at least one curve applied to an existing image I can't try to use the proposed flow.
You too Tin says: does not work on existing image, which is what I need: apply a curve to the input layer.
Thanks a lot for trying.
Sat Jan 27, 2024 5:31 am
ofnuts wrote:dinasset wrote:Sorry Tin and Ofnuts.
- if I copy what you posted (included ofnuts' suggested change) I get a list of messages, but nothing else
- whatever I add in the code, for instance create a new layer, it is executed but then no more filter messages but an error
As long as my little brain does not see at least one curve applied to an existing image I can't try to use the proposed flow.
You too Tin says: does not work on existing image, which is what I need: apply a curve to the input layer.
Thanks a lot for trying.
"List index out of range" when you are using an index of 0 means that the list is empty. And if you have an empty list it is probably because you have no explicitly named settings (as uploaded my code filters out the auto-saved settings).
Sat Jan 27, 2024 5:57 am
chosen_setting_name = 'Yellowing Dark Corners'
chosen_setting = None
for setting in settings:
if setting.name == chosen_setting_name:
chosen_setting = setting
if chosen_setting:
pdb.gimp_message(chosen_setting.name)
pdb.gimp_message(chosen_setting.time)
pdb.gimp_message(chosen_setting.channels[0].name) #value channel
pdb.gimp_message(chosen_setting.channels[1].name) #red channel
pdb.gimp_message(chosen_setting.channels[1].samples) #red channel
redchannel_samples = chosen_setting.channels[1].samples
pdb.gimp_drawable_curves_explicit(layer,HISTOGRAM_RED,len(redchannel_samples),redchannel_samples)
Sat Jan 27, 2024 6:08 am
Sat Jan 27, 2024 10:12 am
Sat Jan 27, 2024 10:29 am
Sat Jan 27, 2024 1:18 pm
dinasset wrote:If choose to load "Alien", the preset is applied because it is inside the 6 presets read.
So, the only thing strange is that the process "load" loads only 6 presets.
@ofnuts
any idea?
Sat Jan 27, 2024 1:58 pm
Sat Jan 27, 2024 2:50 pm
dinasset wrote:If choose to load "Alien", the preset is applied because it is inside the 6 presets read.
So, the only thing strange is that the process "load" loads only 6 presets.
samplesString=extract(r'\(samples \d+ ([0-9. ]+)\)',samplesLine) # skip count value
samplesString=extract(r'\(samples \d+ ([-0-9.eE ]+)\)',samplesLine) # skip count value
Sat Jan 27, 2024 11:11 pm
Sun Jan 28, 2024 12:34 am
Sun Jan 28, 2024 2:14 am
dinasset wrote:Update:
- completed the application of all 5 curves (value, red, green, bue, alpha)
here the new zipped program
Now, because there are incomplete presets(*), I would like to know which statement insert to skip the types absent ("if ...." do not prepare/run the gimp command curves-explicit).
As I said, I'm ignorant enough not to know it myself.
Thanks for any help.
(*) I get always error messages for one channel, different from preset to preset...
Sun Jan 28, 2024 2:52 am
Sun Jan 28, 2024 3:48 am
teapot wrote:dinasset wrote:Update:
I'd suggest you have a for loop that goes through the channels like Ofnuts does at the end of his load-colour-curves-preset.py code:
for c in s.channels:
Or with your variable name
for c in chosen_setting.channels:
Then use c.name to see which one it is e.g. red and c.samples to get the samples.
Unfortunately I'm stuck on an old version of gimp due to hardware issues so can't run your code. (Am hoping for a new computer next month).
channelConstants={
"value" : HISTOGRAM_VALUE,
"red":HISTOGRAM_RED,
"green":HISTOGRAM_GREEN,
"blue":HISTOGRAM_BLUE,
"alpha":HISTOGRAM_ALPHA,
}
for c in setting.channels:
pdb.gimp_drawable_curves_explicit(drawable, channelConstants[c.name],len(c.samples),c.samples)
Sun Jan 28, 2024 6:27 am