Straight forward, if you fancy getting into the underlying gmic code:
Figure out what color you wish to make transparent. Mouse around with the
dropper tool, perhaps. Here, I’ve settled on rgb: (60, 90, 200) and I’m playing
with this image.
Go to your gimp-gmic filter, select it, then choose under ‘Various’ the
Custom code option. Cut whatever is written in the Code textbox and replace
it with these lines:
--fill_color. 60,90,200 # Set color: RGB
-fill. 'gauss(i,0.7)' # Set selectivity: Smaller more selective
Replace ‘60,90,200’ with your color. Set ‘Value Action’ to ‘Normalize’.
Set ‘Input/Output’ ‘Output Mode…’ to ‘New Layers’.
Your display should now look something like this.
The preview shows a mask that, when pasted into a selection channel,
will select your color most strongly, similar colors less
so. White indicates strongly selected pixels; black is deselected.
Experiment with the selectivity value, here 0.7, to vary the
drop-off in selectivity. Smaller numbers are more selective. Useful
range is about 0.0 -> 1.0. Change values as you see fit, click on the
"Update" button to apply changes to the preview.
When you have what seems to work best, hit “OK”. Your mask appears as
a new layer. Select it. Switch to channels, and click-drag any one of
the R, G or B channels down into the vacant area beneath “Lock.” That
becomes your selection mask for the color of interest. Right click on
it and choose “Channel to selection”. You should see marching ants all
over the place. Go back to layers; select your original image, add an
Alpha channel if it does not have one, then Edit->cut away the selected
area. Your image will vary in transparency depending how similar the
color is to your chosen color.
If you want an all-or-nothing binary kind of mask, then use:
instead of the script above. Vary the percentage to set selectivity,
smaller percentage being more selective. Read about -select_color
and all of the other G’MIC commands used here at the G’MIC tutorial pages.
The script subtracts the color of interest from the image itself. That
makes the precise color of interest virtually a zero color vector; similar
colors will have near zero components. We then find the norms of all these
vectors, generating a field of scalars where the more dissimilar colors
are replaced by a grey that varies in proportion to dissimilarity. Running
a gaussian over the field inverts this sense: exact matches become value one,
less similar are darker. Adjusting the radius of the gaussian determines
the sharpness of the drop-off. See -select_color in the tutorials for more
Hope this helps.