I had a paper-and-ink image with a thick black border around it. Past the black border was very dirty white paper. I wanted to (using Photoshop) replace the dirty white paper with pure white, or possibly with paper texture cloned from other parts of the image.
I realized that there was a reasonable gap in luminosity between the border and the dirt, so I figured what I could do is pick a shade of grey somewhere inside that gap, let's call it the threshold, that's brighter than the border, and darker than the dirt. Then just use the polygonal lasso tool to select right down the middle of the black border (so no finicky feathered edges on the selection, just nice straight lines) and select the dirty trim around the image. Fill that area with white on a new layer, and then say "Display this layer wherever the background is brighter than the threshold, otherwise display the background." If I pick the right threshold value, that should have the effect of masking off the dirty white paper, but letting through the border, right? All without the need to do any tedious, risky manual work that might gnaw into the border.
But how can I do that? Is it even possible?