Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Gimp script: Remove holes from selection

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

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

share|improve this answer
    
Horray!!! I was starting to try to write this myself, so relieved to find it already exists. –  foobarbecue May 3 at 14:45

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.

share|improve this answer
    
So there is no way to do convex hulls? –  foobarbecue May 3 at 3:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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