How to display a picture and print pixel coordinates when I click?

When using ImageMagick or similar command line tools it can be useful to know coordinates of some points in the image.

How to display an image (with panning and zooming) and print coordinates of pixels when I click at them?

Nearest thing I found is using ImageMagick's display and clicking the middle mouse button. Magnify 3% window opens with coordinates drawn in overlay. But I need them printed to console, to be reused as arguments in other scripts.


Solution 1:

I ended up coding it myself. You can find my solution here:

https://github.com/vi/DisplayAndPickPixel

Solution 2:

Old question, but it might help somebody else: there's imageJ, an app written in Java, which allows to add macros. One of the examples they provide is PickerPixelTool, that lets you click pixels and sends their coordinates to a window, which you can save afterwards.