Copy link to clipboard
Copied
I've noticed in my time of using the Defringe option, no matter what pixel width I choose, the result is exactly the same.
I'm mostly working with CAD drawings that have been exported to PNGs when I try to use it, and for some reason the software the engineers use has a very slight "glow" on the edge of the parts in the images. I would think if this glow is about 3 pixels wide, that choosing 3 or 4 pixels when defringing would make the program get rid of those 3 pixels of glow, but instead it darkens it a bit but still leaves a glow. The exact same result happens if I choose only 1 pixel, I zoomed in completely on the border to compare and the result is not different at all.
So what's up with this? Is this the case for everyone? Why is it like that? I would love to know how this tool even works, or how it's supposed to work, and why it doesn't ever work for me like I think it should.
1 Correct answer
Thank you for the images, it helps me see what you're working with and trying to accomplish.
TL:DR - This may be a simple case of the wrong tool for the current job. Another workflow is likely what you'll want to use in this type of situation.
I'll explain a bit about Defringe and why this is the case.
This tool is built to help deal with fringe pixels that are created due to the anti-aliasing effects of selections used to cut and paste pixels. This anti-aliasing makes some of the edge pi
...Explore related tutorials & articles
Copy link to clipboard
Copied
Can you provide a sample image and/or screen shot to show what you are encounter?
Copy link to clipboard
Copied
Yup, here's an example of the corner of one of the images, both the transparent image and one with a black background added for visibility.
The top one is the original, the middle is with defringe at 1px, the bottom is defringe at 5px. The middle and bottom ones are exactly the same despite the change in settings.
Copy link to clipboard
Copied
Thank you for the images, it helps me see what you're working with and trying to accomplish.
TL:DR - This may be a simple case of the wrong tool for the current job. Another workflow is likely what you'll want to use in this type of situation.
I'll explain a bit about Defringe and why this is the case.
This tool is built to help deal with fringe pixels that are created due to the anti-aliasing effects of selections used to cut and paste pixels. This anti-aliasing makes some of the edge pixels semi-transparent. Pixels within the selected area might become lighter, for example, when you are removing a dark object from a light background. This change would not be uniform across the entire edge of the selection but would depend on things like the amount of curve in that region. Similarly, the area outside the selection might be pulled in but with very low opacity.
Defringe looks at these edge areas and tries to even things out visually, mostly by either lightening or darkening these pixels but maybe with a little color correction as well.
To determine how much lightening, darkening, or color shifting may need to take place, it will look at pixels which are a little more inward from the edge. How far inward is what the Width setting actually checks. A setting of 1 or 2 pixels is optimal because if you stray too far from the edge you might integrate colors which are not near that border region, causing a different type of color contamination.
The Width setting does not tell Defringe how thick the edge area is. The decission on which pixels are going to be changed and by how much is based on things like how transparent/light/dark any given pixel is, how these qualities compare to its neighbors, and how they compare to the pixels at the Width location. The more anti-aliasing has occurred, the more the pixels will be changed.
That is why you see most of the changes in the curved part of your image and nothing really changing along the relatively straight sections in the upper right and the lower left. And if the pixels are inside the selection enough to not end up anti-aliased (and thus fully opaque, or nearly so), they would be ignored by Defringe even though the are visually different from the rest of the subject area. This is especially true of the thick light area in the upper right.
It's all a lot of very complicated but ultimately unsophisticated math. This is a very old feature, after all. It was made for a time when the selection tools were much more primitive. Taking advantage of better selections to remove these fringe areas would likely be the better solution. The controls in the Select and Mask workspace have options which are probably closer to what you are expecting from Defringe. Settings like Shift Edge and Radius are more likely to give you the results you want.
Copy link to clipboard
Copied
This is exactly the type of answer I was looking for, thank you!
I thought it might be the case that I wasn't using the right tool for the job, (though in that case a lot of people on the internet making suggestions for this type of thing are also incorrectly using it...), and it being pretty outdated.
But it wasn't clear to me what the width setting actually did, even if I wasn't using the tool correctly! That does explain why it occassionally works with some of the smaller images that I'm given too.
So I super appreciate the indepth explaination! 🙂
You suggested to use the Select and Mask tool instead, but unfortunately none of the settings there have ever worked for this specific type of image. In this case, I'm being given images that are already transparent rather than having to do the cutting out myself, so I don't need to/shouldn't chop off any additional edge, plus there's often sharp angles in the parts that don't work well with the settings in there.
So I'll probably keep up my current routine of that + healing brush tool on a darken layer, unless someone else has a better solution to get rid of a glow around the edges? That's probably a question for another thread though.

