okay this is a quite long winded so please help if you can because I have a lot of questions. I am trying to find a pixel by the color its displaying. Now the dream would be to make it where it can find multiple pixels by basicly saying find then color then one pixel over should be this color and down one should be this color and so on so it can basicly read a image. but for now i am only working on finding one pixel color.


My dream is to have it where it will search the screen and find a pixel and move the mouse to that pixel.
A simple example of my dream could be by taking a look at a scripting language called scar. You can google it. Basicly it was orginally made to bot games but I am wanting to make a real program with this technology and somthing about saying here is the script to my clients first of all isnt safe and second dosnt seem to be professional thank you.

Recommended Answers

All 2 Replies

you can do this easily. if you capture the entire screen as an image then just loop through it using the bitmap class's getpixel method and comparing it to the specified color, then saving its location in the image and moving the cursor location to those points.

I don't see the point in it as there are 786,432 possible points in a 1024X768 screen image. and many of them will the the same color.

you could take a count and try to move the mouse to the center of the largest area of similar colors based on a tolerance. which again wouldn't be that hard.

although I see no real world use for this outside of a bot, and I personally hate bots. I know... strong word, but its a strong feeling.

As diamond drake said, it is beyond unlikely that the colour you are looking for will appear in a single pixel on the screen. You are more likely to find a large collection of locations. Diamonddrake's suggestion of finding the area of highest saturation would be a good approach.

Not sure, but it might also be worth splitting the image and multithreading it if you have a multicore processor. That way you could concurrently search multiple areas of the image then jsut collate the results at the end.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.