Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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 '12 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. – Andrew Jul 24 '12 at 23:50
If this is for the web and you're Firefox then there is a extension called ColorZilla. – Anonymous Jul 25 '12 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 '12 at 3:45
up vote 4 down vote accepted

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

3. Create a launcher for ColorPix

  • Let's get an icon first:

    sudo wget -O/usr/share/icons/colorpix.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

share|improve this answer
Exactly what I was after, thanks! – Andrew Jul 29 '12 at 1:27
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 '15 at 17:35

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.


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

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
share|improve this answer

Paste this code into a text editor, make it executable and run. When you choose a color with eyedropper, the x and y coordinates will appear at the top. EDIT: Made 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__":
share|improve this answer
Nice answer. Much more straightforward. – snowguy Jul 24 '12 at 20:30
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. – Andrew Jul 28 '12 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 '12 at 20:42

Try imview , it does show co-ordinates.

enter image description here

You can download its Doc page and man page here.

share|improve this answer
I can't see how to select pixels from the screen with this. – Andrew Jul 22 '12 at 12:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.