Color Selection Based on Neighbor: Is it Possible?

Hello all,

I’m looking to cut down on the tedium of a project by automatically selecting certain pixels for deletion. While I’ve ben using GIMP for several years and I realize the program provides several tools to select based on certain criteria, there is one function that has eluded me.

To cut to the chase, I’d like to use the “Select by Color Tool” but have the selection be contingent on neighboring pixel color as well. For example, I’d like to select the green pixels on the canvas, but only the green pixels that are adjacent to the red pixels (Any other green pixels that don’t share adjacency with at least one red pixel are ignored). The colors are arbitrary but should illustrate what I’m trying to accomplish.

Does anyone know of a way to do this natively or through an additional script? If not, does anyone have a workaround for such a thing?

Much appreciated.

  • Select red pixels (Color selector, possibly with low threshold)
  • Select > Grow by one pixel
  • Set the color selector to Intersection mode
    image
  • Select green pixels
1 Like

Works, thanks!

1 Like