I've got a stroked rectangle and I want only the stroke inside the rectangle to show.
The bottom layer has the stroke over the fill.
The top layer is a duplicate of the bottom layer, except that the fill is black, the fill is over the stroke, and the layer mode is subtract.
Everything looks perfect, EXCEPT there is a thin (one pixel?) line on both the right and left side of the rectangle (where the outside of the stroke would be).
Why are those two thin lines there? Does it have something to do with antialiasing? How ought I make that work right?
Is there a better way to do it?
This will only work if your rectangle is an even number of pixels high and wide and the anchor point is on a whole pixel value. Otherwise you get into sub pixel sampling. You can mitigate the errors by changing the blend mode to Alpha Add for both layers.
If that suggestion does not fix your problem we need to know a lot more about your project. How are the rectangles created? How is the stroke created? I'm assuming you are using Shape layers. If this is correct then my suggestions should work.
You answered my question exactly! Thanks. I can do a matte or a mask, but I wanted to know why those thin lines were there!