5

How can I draw a simple border around a layer in GIMP 2.10?

Filters > Decor > Add Border works on the image as a whole, not an individual layer.

Edit > Stroke Selection has been suggested elsewhere, but I can't figure out how to precisely select the edges of each layer. How would I precisely select the arbitrarily shaped visible contents (polygons and ellipses) of a layer with an alpha channel?

Or is there another way to do it?

======

Sample produced using the technique suggested by Billy Kerr:

enter image description here

2 Answers 2

6
  1. Layer > New Layer or Shift+Ctrl+N (make sure it's transparent obviously)
  2. Select > All or Ctrl+A selects the entire layer. Or if you want to load a shape drawn on a transparent layer as a selection, right click the layer in the layers panel and choose Alpha to Selection. Obviously you will then have to select the transparent layer again before continuing.
  3. Select a foreground colour you want to use
  4. Edit > Stroke Selection - If your selection goes right up to the edge of the canvas, then set a stroke width that's twice the width you need.
  5. If you're using Alpha to Selection, move the layer containing the border under the shape layer if you don't want the border to overlap the image.
2
  • Thank you! Very helpful. I had one issue, though, and that is that it doesn't always produce a border of even width. See sample image above, where the diagonal segment is narrower than the horizontal or vertical one. I tried various combinations of cap style, join style, and miter style to no avail. Square cap style and round join style was the closest, but it produce a border with round outer corners, which is not the desired result. Is there a way of ensuring that it produces a border of even width all the way around, with sharp corners?
    – Bolio
    Commented Aug 3, 2020 at 20:37
  • 1
    @Bolio If you want more control over strokes corners and mitres, then maybe GIMP is not the right tool. These are better handled using vector software such as Inkscape (which is also free and Open Source). You can get slightly better results in GIMP by converting a selection to a path, and using Stroke to Path, but it's cumbersome in comparison to a vector image editor.
    – Billy Kerr
    Commented Aug 3, 2020 at 23:27
0

Had the same issue:

I just add a border to the whole image as you did: Filters > Decor > Add Border

Then:

  1. select the newly created border layer
  2. Shift+s to scale it down to the size of the layer I wanted it to surround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.