It is currently Tue Apr 16, 2024 8:53 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Apply Color Curves Saved Presets (intended for script writers)
PostPosted: Wed May 11, 2016 6:07 pm  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
these scripts help with scripting with applying Color Curves Presets (saved settings).
it works with the "~\\.gimp-2.8\\tool-options\\gimp-curves-tool.settings" file under windows.
You might have to add environment variables HOME to point to your user's home directory.
(I say might because i did that yesterday and it worked, but then today it's gone i can't find the HOME environment variable but it still works for me I read somewhere that this is needed for the scripts to expand the ~ and find your home directory.)
Okay here are the scripts:
1. python "get_color_curves_presets_names.py" intended for scheme script-fu to get a comma separated string of all the presets names
Attachment:
get_color_curves_presets_names.zip [894 Bytes]
Downloaded 296 times

available under <Image>/Presets/Color Curves/Get Color Curves Preset Names (which does nothing when you run it from GIMP because its intended to be called by scheme script fu)

2. python "apply_color_curves_preset.py" will intended for both python-fu and scheme script-fu to call to apply a preset color curve. If you want to allow user to choose from list of preset names just copy the function called local_get_color_curves_presets_names() from this file into your own python-fu script. And then you can set up a PF_OPTION that uses this function to set up the list of preset names. (for some reason when i tried to call the script 1 from above i kept getting some weird error on initialization at GIMP start-up)
version 1: (only works with smooth curves, fails with freehanded curves)
Attachment:
apply_color_curves_preset.zip [1.71 KiB]
Downloaded 263 times

version 2: (works with smooth curves as well as freehanded curves)
apply_color_curves_preset(2).zip
available under <Image>/Presets/Color Curves/Apply Color Curves Preset... (will apply color curve after letting user choose a preset name)

3. sample scheme script-fu file that uses the above python-fu scripts
Attachment:
test_tintran.scm [1.33 KiB]
Downloaded 266 times

available under <Image>/Presets/Color Curves/Script-Fu Test (will apply color curve after letting user choose a preset name)

All these 3 scripts register under <Image>/Presets/Color Curves/ (move it around as you see fit).

If you execute script 2 (python-fu) above it lets you choose from a list of preset names that are present at that time. So if you add a preset color curve, and run it again, the list will update with the new preset.
This doesn't happen for script 3 (scheme script-fu). If you add a preset color curve, you'll have to refresh scripts for script-fu to get that updated list (I haven't figured how or if there's even a way to make it update on its own).

_________________
TinT


Last edited by trandoductin on Thu May 12, 2016 2:36 am, edited 2 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: Apply Color Curves Saved Presets (intended for script writers)
PostPosted: Thu May 12, 2016 2:33 am  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
this is version 2 (uses explicit curve to work with freehand as well as smooth curves)
Attachment:
apply_color_curves_preset(2).zip [1.86 KiB]
Downloaded 339 times

_________________
TinT


Top
 Post subject: Re: Apply Color Curves Saved Presets (intended for script writers)
PostPosted: Sat Aug 20, 2016 1:02 pm  (#3) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
version 3...
previously if we try to apply curves on a layer mask it fails because it tries to apply RED,GREEN,BLUE channels when layer mask doesn't have these channels (it only has VALUE channel).
So this version 3 has that check. If it detects that it's a layer mask, it'll only try to apply the VALUE channel.
Attachment:
apply_color_curves_preset_3.zip [1.91 KiB]
Downloaded 276 times

_________________
TinT


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts [solved ] settings saved in Curves

2

No new posts Attachment(s) Giveaway of the day — Abstract Curves 1.190 + Bonus Presets Pack

4

No new posts Attachment(s) Gimp 2.99's master branch broke all color presets for my plugins

2

No new posts Attachment(s) use of a color curves preset in a python filter

42

No new posts Attachment(s) How to rename an untitled image before it's been saved ?

20



* Login  



Powered by phpBB3 © phpBB Group