Hello Travis,
Wecome to Gimp Chat !
There are a number of ways to skin this critter; I'm one of the G'MIC
bigots resources that hang out here in Gimp Chat, so I'm going that route with you. If you don't know what G'MIC is, there is a discussion group here in the scripting branch (G'MIC Discussions) and a web site
gmic.sourceforge.net that will give you background. The moving spirit behind the project, known here on GC as Ronounours (
David Tschumperlé) is, in real life, a research scientist in the computer vision and visualization field, including medical imaging. One of the serious reasons he wrote the G'MIC framework was to have a image processing pipeline that avoids the common pitfalls of computational artifacts (mach banding, etc) so G'MIC performs all computations in 32 bit floating point. For that reason alone, you should probably work in that environment, because sadly, much of Gimp is still 8 bit, unsigned integer, so chunks of the pipeline lack the numerical precision you (should) prefer. That will change, and hopefully Real Soon Now, but probably not in the next day or two.
Well, in the time that I've written this, your file still hasn't downloaded, so I'm going to have to punt. I'm assuming in colorwheel terms, the transformation you are looking for is something like this:
Untransformed colorwheel -
Blue isolation, translation to grayscale:
The G'MIC filter that rendered this particular transformation looks like this:
#@gimp Blue Filter: blufilter
#@gimp : txt = text("Documentation? You want documentation? HA!!!")
#@gimp : sep = separator()
blufilter :
-e[^-1] "Isolate Blue components via LAB/RGB space modification."
-verbose -
-repeat @#
-local[$>]
-rgb2lab[-1]
-split c
-fill_color[-2] 0,0,0
-normalize[-1] -127,127
-append[-3--1] c
-lab2rgb[-1]
-channels[-1] 2
-luminance[-1]
-endlocal
-done
-verbose +
This is little more than a translation of your process in G'MIC speak; my temptaton is to rewrite it around -select_color, so that you could specify any number of keep-supress hues. And, in the G'MIC-Gimp plug-in there is an interactive LAB filter based on setting curve profiles, as in the Gimp curve tool, so you need not script anything at all, but for now I think best to keep the solution near to the form as you stated it.
So what to do with this? Assuming you have a basic Gimp, you need to install G'MIC. The simplest way is probably to go over to
Partha's Place and fetch a fresh Gimp for your platform; he has pre-installed G'MIC for you. The Official method is to go over to gmic.soureforge.net and fetch the gmic_gimp binary and drop it into your plugin folder. Platform specific instructions may be found on the
download page, scroll down a bit until you see the typewriter text copy.
With G'MIC in place, the little code snippet above will go into your personal .gmic folder ($HOME/.gmic on Linux/Mac/Unix-like) or %APPDATA%/gmic (Windows), the repository for your personal G'MIC commands. Upon plugin restart (or upon starting Gimp) you should have G'MIC as the last item on your Gimp filters menu and something called "Blue Filter" Blue filter has no controls, it will work on the current active layer in preview, and transform the current layer upon "Apply/OK"
For lots and lots of files (did you say hundreds?) I would suggest (strongly) fetching the "gmic" binary from gmic.sourceforge.net. That is a stand-alone, command-line oriented interpreter of the G'MIC scripting language. It has its own looping constructs, or, if your more comfortable with shell/Perl/Python scripting, you could call the gmic interpreter as a subprocess.
That's the basics from the G'MIC front. As noted in the outset, there are many ways to skin this. G'MIC gives you a 32-bit floating point pipeline for a minimum of artifacts arising from numeric precision.
Garry