42

I created a shape in Inkscape and set the border width to 1px.
The actual size is 100px however with a border it's 102px.

How can I set an inner border on the object, not outer? When using Photoshop, the type
is selectable (inner, outer or center border), however in Inkscape there isn't this option.

1

6 Answers 6

27

Inkscape doesn't support changing the type of stroke on an object, however there's
other ways to create the inner border or blur that you need.

One simple method is making a copy of the shape, with no fill and the chosen border (stroke).
This copy is given a clipping path so the extra (outer) part of its stroke can't be seen outside the
original shape. The path used to clip it is a second, unchanged copy of the original shape,
which doesn't appear as a normal/regular object.
To make sure these copies change when the original is edited, they can
each be a linked offset - also allowing them to be moved inside the original shape.

  1. create the shape and select it (F1)

  2. create a linked offset copy, which appears on top of it (Ctrl+Alt+J or Path menu)

  3. change the stroke (border) width to 2x what you need or set its offset
    magnitude/radius to move it to the inner edge of the outer shape border
    - with its node handle or XML attribute (built-in editor, units are pt not px)

  4. give this shape no fill and the chosen border colour - fill and stroke in object menu

  5. create a second linked offset copy of the original shape, leave it unchanged

  6. select this shape and the copy from step 3 (hold Shift key, drag mouse)
    - make sure that this shape is on top (z-order) - see manual page linked above

  7. set clip - use the Object → Clip → Set menu item

Then you should have a finished inner border.

5
  • How do I select pasted and stroke shape? Nothing happens with Shift.
    – Dima
    Jul 12, 2015 at 9:33
  • @Dima See the above answer, that I've updated - you need to drag the mouse or click other objects when pressing the Shift key. Also, the following tutorial page, that can also be seen in the application, could be useful: inkscape.org/en/doc/basic/tutorial-basic.html.
    – Edward
    Dec 11, 2017 at 12:23
  • That's amazingly non-intuitive, but works perfectly.
    – dgo
    Apr 4, 2018 at 20:18
  • Hello year ago me, who forgot about this entirely.
    – dgo
    Oct 5, 2019 at 18:49
  • Mind the issues with printing of clipped objects: Clipped Objects Not Printing.
    – foka
    May 27, 2022 at 13:10
20

An alternative workflow to the one presented by @cristian-ciupitu would be this:

  1. Create (or select) an object or a path with no fill. If you want, you can already set the stroke width (Shift+Ctrl+F), or fix this later.
  2. Duplicate (Ctrl+D) the object/path. This will create a duplicate on top of the original.
  3. Send the duplicate Lower (ObjectLower, or Page Down), so that you can...
  4. ... choose Select (arrow on the toolbar, or F1) and Shift+Click the object/path. As the "Lowered" duplicate was already selected, this will select the two identical objects/paths on top of each other. The status line at the bottom of the window should confirm this.
  5. Now choose ObjectClipSet.

Voila! Inner border!

You can now adjust the inner border width (Shift+Ctrl+F) if you want. Set the stroke width to twice your desired inner border width, as half of the stroke width will be clipped invisible.

If you think steps 3 and 4 are confusing, just drag around the two objects/paths to select them both, clip them as in step 5, and adjust the stroke width as desired. Works as well, but hey, clicking is cooler ;)

2
  • 6
    Essentially you're doing the same thing, but I find your directions easier to understand.
    – SMBiggs
    Jul 9, 2017 at 6:06
  • Mind the issues with printing of clipped objects: Clipped Objects Not Printing.
    – foka
    May 27, 2022 at 13:11
9

Not sure if by "border" you mean "stroke" but it appears SVG standards don't allow for inner/outer strokes, and thus neither does Inkscape. It seems a common thing to do is fake it by duplicating the object and shrinking/growing it so you get the border you want. Though I don't imagine this would work as well for an inner border as an outer border.

Inkscape bug: Inner/outer/center stroke placement

1
4
  • Select the stroke and Path -> Stroke to path, now your stroke becomes a "shape"
  • Use Path -> Division to divide the shape into inner and outer parts.
1

To accomplish this goal, my work around is to first click the option on the toolbar to turn OFF that "Scaling artwork scales stroke"

Scaling artwork scales stroke icon

Next, set your desired stroke width.

Finally, change the size of the object back to what you wanted it to be.

-1

I wanted to do this just because of pure perfectionism, I found out it's not possible, then settled with this solution: if I draw a 100x100 filled square and want it to have a 10 px border, with the square's size remaining 100x100, I just set the stroke size as needed, then set the object's size back to 100x100. Sure, the stroke size changes but I live with that.

You must log in to answer this question.