Sign in to follow this  
Followers 0
Fredledingue

Pixelgetcolor (autoitx3)

11 posts in this topic

Hi,

First of all, a big thanks for AutoItx3! I just start to use it in my vbscripts.

I tried to use the PixelGetColor method.

It returns a number that seems totaly random to me: I expected it to returns the RGB values but it doesn't.

It also doesn't work on overlay windows:

If you play a video and try to get a pixel color value from inside the video window, it will always returns the same number.

I wanted to use this tool to detect automaticaly the color in an overlay window, to see if it's totaly black, totaly pink, totaly blue or if something is playing...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

That is because video overlays are hardware accelerated by the video card. If you hit printscreen, go to mspaint and paste, you will see exactly what autoit sees.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

I tried to use the PixelGetColor method.

It returns a number that seems totaly random to me: I expected it to returns the  RGB values but it doesn't.

<{POST_SNAPBACK}>

You are seeing the decimal representation of the hex number. You could convert it to hex to get the RGB components, but that is rarely needed. Just enclose the color you wish to test against in quotes (like this: "FF00FF") or use the hex number to compare it (like this: 0xFF00FF).

You could also test using the decimal number that the AU3_Spy window returns. There's not a lot of point to this other than to obfuscate your code.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

There is more to it than that. On a video overlay, it will always show up as black "000000".


Who else would I be?

Share this post


Link to post
Share on other sites

There is more to it than that. On a video overlay, it will always show up as black "000000".

<{POST_SNAPBACK}>

Take a screenshot, paste it into any image editing software, and you'll see why. 0x000000 = 0 = black.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

@pekster, DUH!!! RTP!!! [READ THE POST] Does nobody read the posts? You don't have to tell me that, I told him that. DUH.


Who else would I be?

Share this post


Link to post
Share on other sites

@pekster, DUH!!! RTP!!! [READ THE POST] Does nobody read the posts? You don't have to tell me that, I told him that. DUH.

<{POST_SNAPBACK}>

Somehow I thought that he posted that, not you.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

No problem, I just get a little steamed having to restate myself. :ph34r::(


Who else would I be?

Share this post


Link to post
Share on other sites

So no way it can check the color of overlay windows....

Anyway this feature can be very useful for (still) image processing automation.

You can also play a video in non overlay window if you open a first video before. Then the second video (playing at the same time as the first) won't be in overlay.

I will try it as soon as the update is released.

It will be cool to have something like 120;85;12 instead of 54236... 8)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Use this code:

Func DecodeRGB($RGBValue)
    DIM $Colors[3]
    $RGBValue = Hex(Number($RGBValue), 6)
    $Colors[0] = Dec(StringMid($RGBValue, 1, 2))
    $Colors[1] = Dec(StringMid($RGBValue, 3, 2))
    $Colors[2] = Dec(StringMid($RGBValue, 5, 2))
    Return $Colors
EndFunc

Returns an array containing the R, G and B value as [0], [1] or [2].

Edited by sugi

Share this post


Link to post
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
Sign in to follow this  
Followers 0