I want to remove all distinct points from some images, for example like this one:

enter image description here

You can see:

  • points have different color so I can not use select by color tool.
  • point are very close to main part of image so it is hard to use free select tool

But if I turn off RGB channels, image looks like this:

enter image description here

You can see distinct points seems black, but again those are not selectable by select by color tool. Is there a way to select points, which like above are distinct from rest of the image or main part of image?

  • 1
    Have you tried to select by color the transparency zone and then increase the selection e.g. by 2px (this should add the isolated points) and later decrease the selection by the same amount in order to maintain the borders? Try, please, and update us. – Paolo Gibellini May 26 '16 at 12:32
  • @PaoloGibellini Thank you for your attention. Please add your comment as answer, so I can accept that. – hasanghaforian May 26 '16 at 14:43
  • At the moment I have no time to write a proper answers and, as you can see, there are many ways to approach such a problem. Have you tried some of the suggested indications? Can you in case write your own answer? – Paolo Gibellini May 30 '16 at 15:39

The best way to fix images like this is by using layer a mask: a layer mask is a grayscale drawable that is attached to the image, and when turned on, black points on it imply in transparency on the layer, and lighter gray shades imply more opacity up to white which means full opacity.

The transparency provided with masks is in addition to the transparency provided by the alpha channel. You can paint on it with any tools, and even use selections and filters - if you erase more than you should all you have to do is to paint the over-erased area back with a clear color, or white, and you can "unerase" things in any order (not just undo the last brushstrokes as happen when one combiens painting with using Undo).

To enable the mask, right click on the layer on the layers dialog, and on te context menu, pick Add Layer Mask.... Pick the Full Opacity option.

enter image description here

Now, GIMP creates the mask, and makes it the active drawable - that is visible in the program by showing another thumbnail, just to the left of the Layer thumbnail on the Layer's dialog. The mask will be initially surrounded by a 1px white border, meaning it is the active drawable. If you click on the layer thumbnail or the mask thumbnail, you toggle the active drawable (there are options to make it active or not using the menus, but clicking is the most direct way).

With the mask as the active drawable, select the black color, a paint tool, and paint on your image: the areas convered on the Layer will become transparent (and you can spot the progress on the mask's thumbnail). If you overdoo yor transparency, just paint back with white.

Now, just pick a soft brush, the PaintBrush tool, and fix your image as you desire.

Remember to activate the layer (rather than the mask) prior to exporting your image - IIRC there were GIMP versions that would export just the mask in some situations.)

There is a lot to learn about masks, just check the manual: https://www.gimp.org/tutorials/Layer_Masks/


You should have avoided the problem by using another technique to extract the flower from its background (this would have also avoided the blue rim). Typically on such shapes using a Path gives good results.


Another solution:

  • Alpha to selection
  • Select>Save to channel
  • Duplicate the channel
  • Optional but recommended: make your current layer invisible, add a white background, and make the duplicated channel visible
  • Select the channel copy
  • Filter>Generic>Erode (this will remove the one-pixels spots)
  • Add more erode steps if you want to remove bigger spots
  • Do the exact opposite number of steps with Filter>Generic>Dilate
  • Right click the original channel and "Channel to selection"
  • Right click the Eroded/Dilated channel and "Subtract from selection"

You should be left with a selection on your stray pixels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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