I am looking for a tool that lets me select any pixel on the screen and get its RGB color and absolute (x, y) location.

I have used tools on Windows that show a large magnified square with a crosshair letting me easily select the pixel I want and get its details.

Is there anything like this for ubuntu?

  • just curious why you are looking for this particular combination together...that may help us think of an answer. why do you want to know the x,y coordinates and the color?
    – snowguy
    Jul 23, 2012 at 17:42
  • I am writing an automation tool that sends keyboard and mouse input in response to seeing certain things on the screen. Some parts depend on using x,y offsets of certain buttons etc inside a window, and I'd like an easy way to find these offsets exactly.
    – Flash
    Jul 24, 2012 at 23:50
  • If this is for the web and you're Firefox then there is a extension called ColorZilla. colorzilla.com/firefox
    – Anonymous
    Jul 25, 2012 at 1:26
  • Andrew, looks like Ian B wrote a tool that does just what you want. Seems like he deserves the bounty.
    – snowguy
    Jul 26, 2012 at 3:45

6 Answers 6


There is a tool called gpick.

Here you can see an image of the tool. With gpick you can select pixels, see the HTML code, add colors to the palette and generate colors.

To use it, right click the middle of the hexagon then use space bar to save colors into the palette.


  • 1
    Thanks this almost does what I want but doesn't seem to show the pixel coordinates.
    – Flash
    Jul 15, 2012 at 12:14
  • Could you also mark this question as completed?
    – slashcrack
    Jul 15, 2012 at 12:19
  • No - as I still don't have the answer :)
    – Flash
    Jul 22, 2012 at 4:01
  • gpick looks great, just do sudo apt-get install gpick to install it
    – Bloke
    Oct 1, 2015 at 15:54

If anybody wants to do this in the future, you do not need to download anything (certainly not hundreds of megabytes of Windows stuff as another answer suggests). A simple solution Ubuntu comes with is xmag. Xmag is part of the x11-apps package which should already be installed by default.

It's easy. Run xmag, click to pick a region of the screen, then hold down the mouse button in the magnified view to see the exact pixel coordinates.

Screenshot of xmag, sans pointer

You can read the xmag manual by typing man xmag.

  • To change the magnification use the -mag option (defaults to 5), e.g. xmag -mag 10 to blow it up ten times.
    – dessert
    Sep 27, 2017 at 6:32

This will get you what you want I believe. Admittedly it is a few steps but it looks worse than it is since I showed each little step.


Install ImageMagick & Shutter.

sudo apt-get install imagemagick shutter

How to get the x,y coordinates and color

A. Open Shutter and click the selection button

pic of clicking selection button

B. Note that as you move your mouse around it will show you the x,y coordinates you are looking for.

enter image description here

When you've got the right place go ahead and click with your mouse button and draw a square to capture an image. (It doesn't really matter how large your image is just so long as you start it (top left corner) on the pixel of interest.)

enter image description here

C. Close the image in shutter

enter image description here

D. Run the following command from the terminal. This will give you the color values of the top left pixel.

convert ~/Pictures/Selection_001.png -crop 1x1+1+1 txt:- | sed -n 's/.* \(#.*\)/\1/p' 

E. While in the command line go ahead and delete the image so that the next time shutter takes a picture it gives it the same name. (Otherwise you'll need to adjust the name in the previous step (D).

rm ~/Pictures/Selection_001.png

Paste this code into a text editor, make it executable and run it. When you choose a color with the eyedropper, the x and y coordinates will appear at the top.

Edit: Wrote code to add a zoom window. To have it grab pixels outside of the window click the button (not the eyedropper). Click the button again to stop grabbing the pointer. Haven’t figured out how to draw a crosshair with cairo, but you can probably use as is. I left some cairo code in there in case someone can tell me why my rectangle doesn’t draw…

from gi.repository import Gtk,Gdk, GdkPixbuf
import cairo

class picker(Gtk.Window):
    def __init__(self):
        self.connect('delete-event', Gtk.main_quit)
        self.connect('motion-notify-event', self.motion_cb)

        #Setup area for coordinates and zoom window
        self.xcoor=Gtk.Label("x: ")
        coordbox.pack_start(self.xcoor, True, False, 1)
        self.ycoor=Gtk.Label("y: ")
        coordbox.pack_start(self.ycoor, True, False, 1)
        #Trying to draw on Gtk.Image with cairo for crosshairs... Not working
        self.zoomwin.connect('draw', self.draw) 
        self.buttongo=Gtk.Button("Pick Color")
        box.pack_start(coordbox, True, False, 5)

        #Put in color wheel for tweaking color
        self.cp.connect('color-changed', self.on_color_changed)
        box.pack_start(self.cp, True, True, 5)

        #Set some initial parameters
        self.w,self.h=10,10 #Size of zoomed image in pixels
        #set initial zoom image

    def on_color_changed(self,widget=None, data=None):
        #Print out x,y to widgets
        self.xcoor.set_text("x: %i" %x)
        self.ycoor.set_text("y: %i" %y)

    def get_image(self,w=None,h=None):
        #Get a pixbuff image under pointer
        if w==None: w=self.w
        if h==None: h=self.h
        screenshot = Gdk.pixbuf_get_from_window(window,
            self.x-int(w/2), self.y-int(h/2), int(w), int(h))
        return screenshot

    def motion_cb(self, widget, data):
        #What to do while mouse pointer is moving
        #DONT capture every event! Causes too much backup
        if self.count==5:

    def grab_start(self):
        #Grab control of pointer outside of window
        self.grabbing = True
                        True, #allow passage of pointer events to children
                        Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK,
                        None,# could put a custom cursor here

    def button_press(self,widget,data):
        #capture color under the pointer and set the color selection
        color=tuple(map(ord, cenpx.get_pixels()[:3]))

    def grab_stop(self):
        #Stop Grabbing the pointer

    def gobutton_activate(self, widget, data=None):
        #Button control
        if self.grabbing==False:
            widget.set_label("Stop Picking")
            widget.set_label("Pick Color")

    def draw(self, widget, cr):
        #this gets called, but nothing is drawn that I can see...
        w = self.w
        h = self.h

if __name__=="__main__":
  • 1
    Nice answer. Much more straightforward.
    – snowguy
    Jul 24, 2012 at 20:30
  • 1
    Got it working - but I can't see the pixel I'm about to select until after I click it. I was hoping to be able to magnify the area around the cursor so I can make sure I get exactly the right pixel.
    – Flash
    Jul 28, 2012 at 3:32
  • Try it now... Interesting project and I learned a lot. Hope someone might be able to help me figure out why I can't draw on the zoom window with cairo.
    – Ian B.
    Jul 28, 2012 at 20:42

The best fit is...a tiny Windows tool called ColorPix (via WINE)

After searching long and hard, it appears none of the available tools for Ubuntu/Linux fulfill both your criteria, i.e. magnification and coordinate display.

So we go for a tiny Windows tool that -- critically -- just works with a default WINE install, no configuration, installation, DLLs, etc. needed.

  • It features adjustable zoom, one-click copy in multiple formats and co-ordinate display:

    enter image description here

1. Install Wine

sudo apt-get install wine

(that's it!)

2. Download ColorPix

ColorPix can be officially downloaded as a tiny, portable 600KB exe here

I suggest downloading directly to your local binaries directory with:

sudo wget -O/usr/local/bin/ColorPix.exe http://www.colorschemer.com/ColorPix.exe

3. Create a launcher for ColorPix

  • Let's get an icon first:

    sudo wget -O/usr/share/icons/colorpix.png http://cdn.alternativeto.net/i/22e49edc-efa7-e011-979d-0025902c7e73_11865.png
  • Press Alt+F2 now and type gksudo gedit /usr/share/applications/colorpix.desktop, and paste the below and save the file:

    [Desktop Entry]
    Comment=ColorPicker via WINE
    Exec=wine /usr/local/bin/ColorPix.exe
  • From a terminal, run:

    sudo chmod +x /usr/share/applications/colorpix.desktop
  • In a few seconds, it will be available in the launcher as:

    enter image description here

4. Using ColorPix

Start it, and the very first time it may take a few seconds while WINE initializes.

The screenshot below shows it in action, with:

  • The coordinates on the top
  • Color values in different formats below (click to copy to clipboard)
  • Adjustable magnifier below
  • Press any key once you are on your desired pixel to lock values

    enter image description here

  • Well-written, surprising answer - thanks! But it is hard to stomach 625 MB of download for wine, so I'm hoping Ian B gets some help with his cute little python app....
    – nealmcb
    Mar 2, 2015 at 17:35
  • Just use xmag, as described below, and hold down the mouse button on the pixel you want the coordinates of.
    – hackerb9
    Nov 15, 2018 at 16:05

Try imview , it does show co-ordinates.

enter image description here

You can download its Doc page and man page here.

  • I can't see how to select pixels from the screen with this.
    – Flash
    Jul 22, 2012 at 12:40

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.