I'm trying to remove blue skies with clouds quickly from many images. I've used gimp's Color Selection Tool, which selects the sky but not the clouds. Since all clouds are in the sky, if I could expand the selection to encompass everything within the area, I'd be done. Does gimp have a tool for this?

Additionally, it would be great if someone can recommend a way to automate this process, possibly using python scripting for gimp, because I need to do it for a couple of hundred images.

example photo

2 Answers 2


Note: Remove Holes is now included in selection tools of recent versions of Gimp. Older versions may use the approach below:

Gimp script: Remove holes from selection

There is an external script for Gimp which removes holes from a selection. We can download the script (also available from the Gimp Plugin Registry*) and unzip it to the scripts directory we had defined in our Gimp preferences.

*Gimp Plugin Registry is deprecated. A mirrored archive is kept on GitHub

After restarting Gimp we can access the script from Selection > Remove holes... menu.

enter image description here

enter image description here
Selection with holes

enter image description here
Holes removed


If you have a clearly defined border, the "intelligent scissors" tool can usually follow it neatly; unlike the colour select, all the content inside the edge line will be fully selected. The one limitation of the tool is that you can't force it to draw straight lines. To get the selection neatly to the straight sides of the image, you'll need to use rectangle or free select in "additive" mode on top of the edge-detection selection from the scissors.

If your edge is not strongly enough defined for the scissors on their own, you could use the colour select and then switch to quick mask mode. The area you of the active selection will show up as a red mask, and you can paint (or erase) any parts to change that selection. So painting over an unselected area in black (shown as red) will make that area part of the selection when you go back to normal mode.

What may be hard to get your head around is that you can select areas while in quick-mask mode in order to quickly fill them with a solid colour. When you turn off quick mask, the temporary selection is discarded and only the final value of the mask (i.e., the coloured area) is used as your new selection.

So for your image, you could take the selection you had of the blue sky, and then switch to quick mask mode. Using the "magic wand" tool (which selects a continuous area of the same colour) you could select the clouds, which will be a continuous transparent region in quick mask mode. If the gaps in your selection caused by the clouds are safely away from the edges of the masked-out area (sky), you could even just use the basic (rectangle/free) select tools to grab them without worrying about overlapping the already-masked parts. Either way, once selected, use the paint can tool to fill those sections in black, until the entire area you want selected is masked out.

  • 1
    So there is no way to do convex hulls? May 3, 2014 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.