32

Oftentimes, I need to measure the dimensions of part of an image (in pixels). In Photoshop, I can make a rectangular selection and see the dimensions in the "Info" window (or something like that). How can I accomplish this in GIMP? The only thing I've been able to come up with is:

  1. Make a selection
  2. Make a new layer
  3. Fill the selection
  4. Autocrop the layer
  5. Open the scale layer dialog to see the dimensions

There must be an easier way.

1
  • 6
    In my GIMP 2.8 install, when using the rectangular selection tool, I can see the current dimensions of the selection as I'm drawing the rectangle. It's at the bottom of the window of the image being edited. It also seems to be displayed under "Tool Options" in the Toolbox for Rectangle Select, listed as "Size".
    – Josh
    Jun 8, 2015 at 20:16

6 Answers 6

37

In GIMP, the status bar at the bottom of the window will show you the dimensions while you are selecting, but it disappears when you finalize the selection. I suspect that is because the selection can be shapes other than rectangle. If you want to see it afterwards, make sure the Windows --> Dockable Dialogs --> Tool Options pane is enabled. It may already be docked on your Toolbox. This will show you the position and size of a Rectangle Select. You can also modify the size of the selection from this pane.

I am using GIMP 2.8 on Windows.

4
  • Don't feel bad. It took me a while to spot it, too. Meanwhile, @Josh R. beat be to it in the comments. Jun 8, 2015 at 20:25
  • This does not work on Mac OS X
    – Sébastien
    Oct 25, 2016 at 9:57
  • Does Adobe patented their Ctrl+C Ctrl+N Ctrl+V ? Anyway, with this GIMP feature you will train your memory and that's good
    – rook
    Jan 18, 2019 at 13:16
  • 3
    This works if you've just used the rectangle select tool but not if you used alpha to selection, fuzzy select or anything else. All these years later, I still can find an efficient way to reliably get the size of an arbitrary selection. Feb 21, 2021 at 15:55
5

If the above solutions are inelegible and your selection equals the current layer, you might also measure the size of the layer using "Layer" -> "Scale Layer".

5

Anyone knows how to measure selected area? I have irregular shape selected, and I want to know what is the area of that selection, for example in square pixels.

Edit:

I found the answer by myself, simplest solution was to open histogram dialog (Windows → Dockable Dialogs → Histogram), there you can find pixels count of selected area.

enter image description here

2
  • The selection for “Channel” in the dialog seems to make a difference, though. For me, it seems that keeping the default “Value” is best.
    – caw
    Jan 19, 2021 at 2:38
  • This is really a different, related question. Feb 21, 2021 at 15:44
2

GIMP shows the ongoing selection dimensions in the status bar, just on the bottom of the window. enter image description here If that is not enough for some reason, there is a "measurement tool" you can pick on the toolbox (on the default configuration, just following the "zoom tool") - which will give you any linear size, and also angles of measured lines.

0

In the tool options window for rectangle select, you can see the size values

enter image description here

0

Information about the current selection can be found, even before/after using the selection tools. In Gimp 2.10, this data is exposed using the pdb.gimp_selection_bounds() function, which can be run from the Python Console (Filters/Python-Fu/Console):

>>> [pdb.gimp_selection_bounds(img) for img in gimp.image_list()]
[(1, 124, 180, 310, 257)]

The 1 here indicates that the selection is not empty, the 124 and 180 show the x and y starting points for the selection, and the 310 and 257 show the x and y ending points for the selection. Note that no matter how complex your selection is, you will still only get back information for a single rectangle encompassing all components of the selection. If you feather a selection, the dimensions will expand to cover even the slightest % selected pixels. There will be more than one entry in the list if you have more than one image open.

>>> pdb.gimp_selection_bounds(gimp.image_list()[0])
(1, 98, 130, 254, 216)

If you know what index the image you care about is in the gimp image list, you can pick it out directly so you don't have to sift through the others.

>>> bounds = [pdb.gimp_selection_bounds(img) for img in gimp.image_list()]
>>> [(bool(b[0]), b[3] - b[1], b[4] - b[2]) for b in bounds]
[(False, 1920, 1080)]

With a little extra work, we can calculate the size of the selection based on the bounds we get back. Here we see that there is no selection; the dimensions of the image are shown instead.

>>> bounds = [pdb.gimp_selection_bounds(img) for img in gimp.image_list()]
>>> [(bool(b[0]), b[3] - b[1], b[4] - b[2]) for b in bounds]
[(True, 186, 77)]

Here we see that there is a selection, and the width and height of the current selection are calculated.

All of this can also be run from the Script-Fu console, but the code will look a little different. For more frequent use, I would recommend creating a plugin to pop up an info box and assigning a keyboard shortcut, but that's a solution I'll leave to the reader.

You must log in to answer this question.

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