Find the answer to your Linux question:
Results 1 to 2 of 2
Hello guys the thing is im writing a script for a game im playing. I want it to press ctrl+L when any pixel of the screen turns of a given ...
  1. #1
    Just Joined!
    Join Date
    Jan 2012
    Posts
    1

    Getting color of 'x' 'y' pixel

    Hello guys the thing is im writing a script for a game im playing. I want it to press ctrl+L when any pixel of the screen turns of a given color or RGB or hex. I only need a command or program that reads a given xy pixels and give me its RGB or hex info on the output. or that reads the full screen. I don't need a program that needs the pixel to be selected with a crosshair, i need it to use the given xy coordinates. Oh and I am using bash but if you don't know how to do it in bash, well every suggestion is accepted.
    this is wht i'm looking for more or less:
    Code:
    $ getpixelinfo 653,287  #being 653,287 the respective x,y coordinates
    and the output would be:
    Code:
    21,132,67  #in RGB
    11a1a11aa  #in hex
    Thanks in advance!

    EDIT: It doesn't have to be an image file! I need it to work on the game screen without taking an screenshot! plz help

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You'll probably need to write some X-Windows software to do this - not complex, but you need to learn how to write X-Toolkit code probably. In any case, you might check into the source code for the pixeltool program which may help point you in the right direction. I'd help more, but I haven't written any low-level X11 code for about 15 years. I still have all the manuals in my personal library though, so I can probably critique what you do.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...