156

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

How can I do that?

2
  • 5
    On the gimp documentation, they recommend using InkScape for drawing shapes . They say "GIMP is not designed to be used for drawing". docs.gimp.org/2.10/en/gimp-using-rectangular.html. But the answer below is the one I went with, perfect for a simple rectangle.
    – Wadih M.
    Commented Dec 10, 2021 at 18:45
  • Gimp can be thought of as FOSS adobe Photoshop, whereas Inkscape is FOSS adobe Illustrator. Photoshop/Gimp is for raster/photo editing, whereas Illustrator/Inkscape is for vector/illustration editing. Commented Sep 2, 2022 at 2:34

6 Answers 6

144

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.

14
  • 7
    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
    Commented Jul 27, 2010 at 13:02
  • 53
    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
    Commented Mar 25, 2015 at 10:45
  • 4
    paint.net is propitiatory non-free-software. Commented Feb 25, 2017 at 11:13
  • 3
    @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
    Commented Jul 11, 2017 at 23:48
  • 3
    Doesn't work for me. The Stroke Selection option is greyed out. @Marc – it's dead-easy in photoshop... choose the shapes tool (make sure it's a square using long click), then draw your square. What could be easier?
    – geoidesic
    Commented Nov 13, 2018 at 14:33
66

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

enter image description here

6
  • 6
    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
    Commented Nov 13, 2018 at 14:37
  • @geoidesic I can confirm it working for Ubuntu 18.04.1 using GIMP 2.10.8
    – k0pernikus
    Commented Nov 15, 2018 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
    Commented Nov 15, 2018 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. Commented May 31, 2019 at 7:38
  • 6
    It's really hard to select location accurately from that small preview box.
    – Jaakko
    Commented Jan 27, 2020 at 8:53
19

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 https://i.sstatic.net/SHzjr.png

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

5
  • 3
    no, no, no ... too many politics :) Commented Mar 11, 2016 at 4:07
  • 3
    lol this made me crack up at work xD
    – Katie
    Commented Aug 12, 2016 at 18:00
  • 1
    This tells you what you can do, but not how to do it :-|
    – geoidesic
    Commented Nov 13, 2018 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
    Commented Nov 15, 2018 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
    Commented Nov 15, 2018 at 15:32
17

@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
  • 4
    Thank you for this explanation. This is the most helpful answer here.
    – Nav
    Commented Dec 31, 2020 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .