96

I want to draw a box around a portion of my graphic for the purpose of highlighting it.

How can I do that?

3
  • I really don't understand why such a basic question has so many upvotes and answers... – Xeнεi Ξэnвϵς Jan 20 at 10:41
  • 1
    @XeнεiΞэnвϵς because GIMP is counterintuitive AF? – Remy Mar 2 at 21:31
  • So counter-intuitive that sometimes I find my own answer with google when I ask the same question again. – I Support The Boycott Mar 2 at 21:33
86

Use the rectangle selection box, and under the Edit menu, hit Stroke Selection. Select your options from there, and hit "Stroke" to apply the stroke.

12
  • 6
    GIMP is a powerful piece of software and as such has a pretty steep learning curve. For quicker, easier tasks I would recommend Paint.Net. Think of it as MSPaint++. – Michael Jul 27 '10 at 13:02
  • 24
    @Michael GIMP can do anything Photoshop can do… But with one of the worst GUI/user-experiences ever. – Giacomo1968 Feb 3 '15 at 23:53
  • 29
    GUI of GIMP is a disaster. I simply can never find the buttons to do whatever I need to do. Having to Google how to make a rectangle says it all I think! – JohnyTex Mar 25 '15 at 10:45
  • 2
    paint.net is propitiatory non-free-software. – ctrl-alt-delor Feb 25 '17 at 11:13
  • 2
    @JohnyTex I also find the GIMP UI disgusting to an extreme, but, in all fairness, drawing a box in Photoshop isn't all that straightforward as well. – Marc.2377 Jul 11 '17 at 23:48
56

Select Filters > Render > Gfig... From there you can draw boxes and other shapes boxes in various styles.

enter image description here

5
  • 1
    Doesn't work for me. Gfig opens a dialogue box with a whole bunch of things inside, none of which are clickable. It all just seems to be disabled. The only UI element that worked on that box was the close button. – geoidesic Nov 13 '18 at 14:37
  • @geoidesic I can confirm it working for Ubuntu 18.04.1 using GIMP 2.10.8 – k0pernikus Nov 15 '18 at 11:11
  • Actually I've noticed a few other dialog boxes suffering from the same problem on Mac OS X Mojave. Alt tabbing a few times seems to unblock the dialog box and allows one to edit. – geoidesic Nov 15 '18 at 15:29
  • It works, but strangely. For example, I draw a square box in a picture and the box does appear, but smaller then what is drawn in the preview. Nothing seems to fix it. – Roel Van de Paar May 31 '19 at 7:38
  • 3
    It's really hard to select location accurately from that small preview box. – Jaakko Jan 27 '20 at 8:53
15

Use the box select tool, then Select >> Border This selects around your current selection's outline (dotted animated line), at a distance of however many pixels you enter in the dialog box on either side of original line. i.e. if you use 5 for Border's input value, you will have a 10 px wide border selected. Then fill it in with paint bucket. You now have a box. Or... fill a layer with any colour, pattern, gradient, image etc., and use the selection to create a black box in a white layer mask using the same selection. Select all on layer mask, and gaussian blur a bit. That will give you a blurred border, using whatever image is on the layer. Everything that is black on the layer mask will be transparent to the layer below. Using this image as the main layer, I created a thick blurred border, but started with a circle selection instead of a square. I also did a border select on the original border select (after filling in layer mask) to blur the edges of my new border, and not the whole border.

Original: http://www.theblaze.com/wp-content/uploads/2013/11/Kim-Jong-Un-AP.jpg

New Border http://i.stack.imgur.com/SHzjr.png

Example using black layer instead of image, and rounded corners. http://i61.tinypic.com/2yovj0j.png

5
  • 2
    no, no, no ... too many politics :) – CEO at Apartico Mar 11 '16 at 4:07
  • lol this made me crack up at work xD – Katie Aug 12 '16 at 18:00
  • This tells you what you can do, but not how to do it :-| – geoidesic Nov 13 '18 at 14:33
  • This answer is wrong, you can't fill a selection with the paint bucket. Once you click the paint bucket tool, the selection disappears. – geoidesic Nov 15 '18 at 15:31
  • It also says "use the selection to create a black box in a white layer mask" but it doesn't tell you how. Select just draws a selection, it doesn't allow you to "create a black box in a white layer mask". If we knew how to "create a black box" then we wouldn't be asking this question! – geoidesic Nov 15 '18 at 15:32
3

@Aeo answer is not clear enough:

  1. First use the Rectangle Selection to draw your rectangle/box enter image description here enter image description here
  2. Only then, go under the Edit menu, and hit Stroke Selection. enter image description here
1
  • 1
    Thank you for this explanation. This is the most helpful answer here. – Nav Dec 31 '20 at 10:46
1

After going through all these convoluted answers, I figured out a simpler one.

Create a new layer. Set the opacity to 50%. Set your foreground color to yellow (or whatever). Click the Rectangle Select tool. Draw a box around the text you want to highlight. Don't hit enter. Go immediately to the edit tab, and select Fill with foreground Color. Hit enter. Ta Da!

0

Create keyboard shortcuts for it

If you are using this a lot, create custom keyboard shortcuts for it as mentioned at: https://docs.gimp.org/2.10/en/gimp-concepts-shortcuts.html

  • Edit
  • Preferences
  • Interface
  • Configure keyboard shortcuts

Then, search for: "Stroke Selection".

Two possibilities open up, and I set:

  • "Stroke Selection": "Ctrl + Alt + ,"
  • "Stroke Selection...": "Ctrl + Alt + ."

These are inspired by the similar predefined fill shortcuts "Ctrl + ," and "Ctrl + .".

Now:

  • "Ctrl + Alt + .": used for the first stroke. This opens the menu of stroke properties, from which you can select stroke parameters such as line width.
  • "Ctrl + Alt + ,": strokes immediately with the previously selected stroke properties

Also note that you can make multiple rectangular strokes at once by selecting multiple rectangular selections at once by holding Shift:

enter image description here

and then after "Ctrl + Alt + ," it immediately becomes:

enter image description here

Tested on Gimp 2.10.18.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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