Jump to content

Finding a Pixel Color


Recommended Posts

Well, I need a function or something that allows me to find the pixel color of something on the screen. The X and Y coordinates of this pixel are random, so how would I just be able to grab a pixel color from a random place? If someone could please post back here with an answer I would be very grateful. Thanks :whistle:

Link to comment
Share on other sites

Hmm, I still need some more help on this topic. I can't figure out how to get those all to work together. I know it's easy, but I can't grasp it...

When you say " The X and Y coordinates of this pixel are random, "

Is there a specific color that moves randomly around the screen that you are trying to find? If so, then you answer is "PixelSearch()"

But to grab A random pixel color from anywhere on your desktop, try something like this:

$x = Random( 0, @DesktopWidth,1) ;Random number between 0 and the width of your desktop (in pixels)
$y = Random( 0, @DesktopHeight,1) ;Same as above, just with height

$color = PixelGetColor($x,$y) ;gets the color of the X,Y Coords and sets "$color" to it
Msgbox(0,"Random Color Finder", "Random Coordinate: ("&$x&", "&$y&")"&@CRLF&"Color (Dec): "&$Color&@CRLF&"Color (Hex): 0x"&Hex($Color))

EDIT: btw, I am unable to test atm, but i am pretty confident that it will have no errors. I'm at work :whistle:

Edited by Paulie
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...