29

I want to measure the precise pixel coordinates within an image where the mouse cursor sits.

Are there stock OS X or third party tools that can easily do this?

6 Answers 6

28

You can do this simply by dragging from the desired pixel to the upper left corner of the screen. This will create a selection rectangle, and the size of that rectangle is shown in the screen. Since the rectangle can only stretch until it reaches the origin (the corner), its size will be the same as the pixel coordinates you're looking for.

11

Not that I know of. The closest stock solution I personally use is to take activate the utility to take a screenshot of a screen portion (Command ⌘+Shift ⇧+4). The cursor will turn into a crosshair with the screen's horizontal and vertical pixel coordinates. You then have to apply some math to determine the distance between the end-points you want to measure. Not ideal, but better than nothing.

You can also try using xScope, a nice 3rd party utility which makes life a little bit easier with dedicated tools, but it is zoom agnostic, so make sure you measure at 100% zoom.

Photoshop is the only tool that effectively takes pixel distances regardless of the zoom level, but you have to open the image or at least a screenshot (if you take it from a website or PDF) in Photoshop.

2
  • I generally use Gimp for this task, although it is indeed also ill-suited for making a quick one-off calculation.
    – noffle
    Commented Sep 24, 2012 at 22:23
  • While in the crosshair-selection mode, while the mouse is moving, the coordinates are the size of the screenshot. For a second or so after the mouse pauses, the coordinates show the location on the screen of the crosshair. To get the coordinates in a window or image, start the selection box at the upper-left of the window or image.
    – Cajunluke
    Commented Sep 26, 2012 at 2:39
10

I needed something very similar (coordinates of bounding boxes around certain objects in image for computer vision research). I build a simple tool that runs in the browser: http://nicodjimenez.github.io/boxLabel/annotate.html

3
  • This is maybe the best answer I ever read in my whole 15-year of reading advices on the net. congratulation ! Commented May 17, 2016 at 21:34
  • 1
    Does this still work? I tested on Safari, Firefox and Chrome. But the tool would not show any coordinates.
    – normanius
    Commented Jul 24, 2020 at 19:22
  • 1
    @normanius yangcha.github.io/iview/iview.html working web same like the answer the original has JS error
    – buncis
    Commented Mar 23, 2021 at 21:30
6

While it may be a bit cumbersome, I use the Rectangular Selection Tool, then go to a corner of the image that suits your coordinate system (top-left in some cases, bottom-left in others) and stretch the rectangle to the desired position.

The size of the rectangle shown in the tooltip will be your position.

Zooming in helps to be more precise.

enter image description here

2
  • This seems to be pretty much the same answer as the one given by vinivendra five years ago, no? Commented Oct 11, 2019 at 11:43
  • You're right! Somehow I missed it.
    – Cristian
    Commented Oct 16, 2019 at 22:08
3

Via this answer to a related question:

Preview (included in OSX): Select a Text Box then from Tools -> Show Inspector pick the 4th tab that has a little ruler icon. This gives coordinates with an upper-left origin.

1
  • Which version of macOS does this even work in? There's no "tab with ruler icon" in Preview's inspector window, AFAICS. using Monterey.
    – myxal
    Commented May 31, 2023 at 9:24
2

I would suggest using GIMP for this. Firstly, import your image, right-click on it, and select Image -> Crop to Content:

enter image description here

This ensures that the canvas is the same size as your image so that if you hover at the top left of the image, the coordinate display at the bottom left shows 0, 0:

enter image description here

I found this to be superior to the Cmd + Shift + 4 method in Preview.app because it shows a true image coordinate, whereas with Cmd + Shift + 4, I found that if I resized/panned around the image and hovered over the same point, it would show different coordinates.

You must log in to answer this question.

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