Options to Stroke Selection Inside/Outside

I find selections + Stroke Selection with a solid line to be a quick way to draw outlined raster shapes with a set stroke width, it’s a lot less work than setting up the perfect outline brush for the shape tools, and selections can give me more precise and complex shapes.

However, their usefulness for precisely sized selections and selections with sharp corners is limited because the stroke is always centered on the selection edge:

  • If I want to draw a 100x100 box with 4px border, I have to think ahead and stroke 8px and delete the outer or inner part of it, depending on where I want the border. Deleting can be non-trivial if the relevant space has other things in it - it’s safest to create a temporary layer to do all this on, which adds even more steps. I need precisely-sized boxes and other convex shapes like this a lot when I’m making pixel art game UI.
  • If I want to add an outline to a character or object, it’s very easy to select that character or object and then stroke the selection, but this too requires extra steps if I want the outline to be outside the character.

Aside from doubling the desired stroke and removing half of it, another option is to use Layer Styles, which do have Inside and Outside options. However, they apply to the entire layer, so they add extra steps: make a new layer with your selected content (or with white on Multiply for when the content is empty and you want only the stroke), set the stroke style (including the color - can’t just use Foreground Color there), then merge with the layer the strokes are supposed to be on. Being able to Stroke Selection Inside and Outside would remove all these extra steps and speed things up for me.

I suspect this option isn’t available for Stroke Selection for the same reason it’s not available for the shape tools - support for Brush strokes makes it more complicated. While I’d love to see Inside/Outside options for that too, for my needs, I’d be happy with these options available only for “Solid line” strokes, which hopefully can be implemented similarly to the Stroke Layer Styles.

1 Like

Basically what this would need is to have the path of the original shapes get offset (which can be tricky but is not impossible) and this offset is then stroked… So it’s not impossible, we just need to find someone who likes bezier curves to work on it.

(I want to add that we can’t really use the vector tools here as inside/outside doesn’t have a definition in either SVG1.1 or SVG2.0, much to the sadness of the Inkscape devs)

4 Likes

(Guess who forgot they made this thread already…)

Something else to consider is where odd-width strokes are placed exactly. Currently, a 1px stroke creates an outline that’s 2px-wide but at half opacity, because it’s centred on the border between pixels. A 5px stroke creates a 6px-wide outline where the inner and outermost pixels are at a lower opacity. While that arguably makes sense for a “centred” stroke (I’d argue most people would probably rather the outline be exactly the width they selected, and just not exactly centred), it would be unacceptable for inside and outside strokes. I guess if the path is offset by half the width, that should result in odd strokes being centred in the middle of a pixel and producing correct strokes. If this offsetting is implemented, perhaps it could also be used to make sure odd-width strokes produce actually odd widths, by offsetting the path by half a pixel when the width is odd.