You are here

Balance colors through samples indicated as gray.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

This little script was inspired by "GIMP tutorial - advanced color correction using sample point and curves" which nicely describes a method to get the color balance of a drawable right.
It expects an active path. If it's not there it exits unceremoniously.
The average RGB values of a 5 pixel radius area around the points in the path are taken and from these color adjustment curves are invoked with the aim to equalize them and thereby get the color balance right.

Original picture

After Correct Grays....

Just copy the "" script to your plug-ins directory. "Correct Grays..." can then be found in the menu under "Colors/Q&D"

Create a path containing one or more points that should be proper gray (i.e. RGB equal) and fire.

The script is Quick and Dirty. It uses deprecated procedures 'gimp_path_get_points' and 'gimp_path_get_current'.
I would rather have used the current 'gimp-image-get-active-vectors' and 'gimp-vectors-stroke-get-points' instead but I couldn't get that marching straight away. Some advice will be appreciated ;-)
With these a proper check on an active path seems a doddle to me.
Interactively setting the sample radius can easily be implemented but just gets in the way in my case. RSI avoidance policy.
Interactive sample selection and preview would obviously be very nice but I don't think that can be done from a script easily.

I've also added a Quick and Dirty "one liner" script which does a color value enhancement with a fixed "S-Curve". Not very refined but rather useful when dealing with a bunch of bland images I find. Also fun to play around with and see what the 'gimp_curves_spline' procedure does.
In fact I regularly use a version of the first script with this procedure incorporated for the real Q&D work.

After Enhance Values...

I tested it with 2.8 but I assume it works with older versions with python support as well.

The scripts14.26 KB
GIMP Version: 
Subscribe to Comments for "Balance colors through samples indicated as gray."