In the image attached A and B are two separate layers. They are two different selections pasted from the original image. If you look closely there are some transparent/opaque pixels between the two. What is the best way to make the get rid of these gaps?

Do I need to stroke the top of layer B and get PS to decide what colours the new filler pixels need to be.

I have saved all of my selections.

I've tried defringe: https://photoshoptrainingchannel.com/tips/removing-edge-halos-defringe/ but it didn't appear to do anything.


enter image description here

  • 1
    Is the purple on a third layer serving as a background?
    – Ryan
    Jul 1, 2015 at 1:51

5 Answers 5


The magic wand tool only really works well where there is a definite edge. Polar1ty's select/contract/erase answer is helpful as a quick fix if the purple edge is even. However, I believe your best bet is to learn how to use the pen and mask tools. The advantage of using the mask tool is that you can non-destructively hide sections of the image (unlike the eraser tool) which makes it far easier to fine-tune after. I'm going to show you how to do this with pen tools but there are many ways to make a good mask layer.

On the Paths window (Window > Paths) click the "Create New Path" button and ensure the path is selected. Now grab the pen tool (P) and trace around the image, clicking along the edge of the pixels that you want to keep till you have a full loop that encircles them all. You can click and drag to form bezier curves to go around curved objects. You can also hold Ctrl, while using the pen tool, to edit previously placed points easily. There are better guides, a quick search away, for using the pen tool if you find yourself getting stuck. The advantage of using paths instead of a selection tool is that you can edit the path, rather than start from scratch if you mess up.

enter image description here

I know my example doesn't have a purple edge but it's all the same, you want to place your path so that it doesn't include any of those purple pixels.

Once you've made your path, load it as a selection, either with the button in the Paths window, or by Ctrl clicking the path in the Paths window. Now with the selection highlighted, select the layer you want to mask to be applied to and add a layer mask with the button at the base of the layers window (Window > Layers).

enter image description here

This should leave you with a layer similar to above. If your image isn't very sharp, you may want to select the layer mask and in the Properties window (Window > Properties), drag the Feather slider up a bit to soften the edges. If you still have a bit of a purple edge to remove then you can use the brush tool with black to paint onto the layer mask to hide more. You can now add layers below.

Your results may vary and it will take a little bit of practice and experimentation to get used to using the path and mask tools. It really is worth the effort; these tools are some of the most useful tools that Photoshop has (or any other image editing software).

You can also combine Polar1ty's answer with this method. As you have a cut-out area already, you can Ctrl click the layer and contract the selection (Select > Modify > Contract) and then make a layer mask which you can neaten up after.

enter image description here

"Leaf blower man, oh leaf blower man... Please bugger off (away from my office window)" - marcusdoesstuff

  • Instead of using Feather you might want to use Refine Edge for better results.
    – Ryan
    Jul 1, 2015 at 10:55
  • Possibly. I've not tried it before... But feather on a mask can be increased and reduced non-destructively which is a nice bonus. Jul 1, 2015 at 14:00

You can delete the semi-transparent/border pixels on layer B.

  1. Select the background of layer B(which seems to be transparent) using the magic wand tool(Magic wand tool).


  1. Go to "Select->Modify->Expand", then expand the selection by about 2 pixels.

Expand selection

  1. Delete the selection.

Delete selection

The result is the semi-transparent/border pixels deleted with the red border being the semi-transparent/border pixels in this case.

  • Should actually be "contract" the way you are describing...
    – cclark413
    Jun 30, 2015 at 14:28
  • @cclark413 No. You select the background so you expand that selection which contracts the inverted selection. Jun 30, 2015 at 15:05

If they are two different selections from the same image, say the sky and the rest; when properly done they will line up with no gap. I do not know the reason for this, but here is the selection process I will suggest:

  1. Select part A, the sky, press Ctrl-J. This will create a new layer from the selections
  2. Ctrl-Click on the new layer which will load it as a selection
  3. Target the original layer where you want to select the second part, B
  4. While the selection is still active, press Shift-Ctrl-I to invert the selection. Now the opposite of the first selection is selected.
  5. Press Ctrl-J which will now create a new layer with part B.

When you turn off the original layer, the remaining two layers will perfectly line up with no gap.

Depending on the reason for this question, there may be other, better ways of achieving the desired result. This answer is specific to this question the roots of which elude me.


The one solution is you have to fill the gaps.

Try it using the Smudge tool to fill the gaps.

  • Could you please explain a bit more? How would the asker use the smudge tool to fill the gaps? Thanks!
    – Vincent
    Jul 1, 2015 at 8:58

Try using the feather selection tool.

This link should resolve your problem.

Feather image guide from Adobe

If you still have doubts, refer to the video.

Youtube video on how to do feather selection

  • Hello Neutrino, welcome to GD.SE and thanks for your answer. Could you please edit your answer to include the important information from the links you post? That way, your answer is still valuable in case the links break at a later time. Link rot is the main reason we really dislike answers that rely on links here. Thanks! If you have any questions about this site, have a look at the help center or feel free to ping one of us in Graphic Design Chat once your reputation reaches 20. Keep contributing and enjoy the site!
    – Vincent
    Jul 1, 2015 at 8:57

Your Answer

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