#๐ Pixel color detection
33 messages ยท Page 1 of 1 (latest)
@ripe leaf
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I allow using anything just to simplify the code
Hey @ripe leaf ๐
Read this message.
You probably want pyautogui:
im = pyautogui.screenshot()
px = im.getpixel((x, y))
There is a wrapper that lets you get pixel information from a coordinate pair that you can use as well.
px = pyautogui.pixel((x, y)) ```
(Text highlighted from [this StackOverflow post](https://stackoverflow.com/questions/64722136/how-to-use-pyautogui-to-detect-rgb-values)) @ripe leaf
yeah i want this but in real time
any way to do that?
Is this realtime on you computer?
yeah
On you screen, or on your webcam
screen
And what is the end goal once the pixel colour has been determined
what is the output, this will make sense why I am asking once you answer
to do a certain action, basically macro really
output?
Ah, and is the macro already written in py?
if not I would recommend AHK
I've done something similar to this before
The PixelGetColor function retrieves the color of the pixel at the specified X and Y coordinates.
its another scripting language, really good for macros
what ide do i use for it?
I just used notepad++
ight, thanks
but again, feel free to wait around for someone to tell you how to do this in py. Just throwing in my two cents
it actually seems interesting, ill try ur way
The only way I can think of how to do it in py is get a screenshot, then use numpy/cv2 to get the colour at a location, that just seems pretty "heavy" to just trigger a macro
best of luck, here is the AHK discord if you are looking for help
https://discord.gg/autohotkey-115993023636176902
i saw that pyautogui has an open image thing, so im guessing that it would be just extra macro steps actually
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
๐ Pixel color detection