Jump to content
IAMK

How is a pixel's color calculated by AutoIT?

Recommended Posts

IAMK
Posted (edited)

Hello,

I have spoken to the artists in my company, and none of them understand the cause of this issue. Apparently NO masking is done, so the pixel colour of the image should not be changed.

Example: Layers.png
I cannot show the actual image, as it's from an unreleased game. Bottom->Top layer:
Green(image), Black(animation), Red(animation), Orange(image).
If I check the pixel colour of the green image, it changes (which I thought was caused by a mask from the animations which covered the image, but is apparently not the case according to the artists).
As for the orange image, which is in the very top layer, the pixel colour of the centre remains a solid colour as it's supposed to, but if you go closer to the edge which is above the black animation (even 50pixels away), the pixel colour starts changing. Even if masking was an issue for the green image, this should NOT be the case with the orange image, which is on the top-most layer.

The script I use for pixel colour detection: IAMK_PixelColour.au3

 

Something I can share: The script does not work properly on this forum. Run the script and see that hovering over the grey and white parts on this forum yield the same decimal colour. It remains "16382457" on the left, and ??? on the right... Image: LookAtThese.png
I took 4 screenshots while writing this thread. p.s. the cursor is slightly up and to the left of the box in the pictures. If you take a screen shot of this page, past it into Paint, paintbucket the grey to black, you will see it perfectly recolours up until the white. There is no gradient. It seems to be reading a mix of colours below or something?

 

Question: What is the issue with my script? Or what is the issue with PixelGetColor()? Or how does AutoIT calculate/determine "pixel colour"?

My assumption was that regardless of monitor, the COLOUR of each PIXEL was simply ONE VALUE (the very top-most value) of a render. Meaning if you have 5 animations layered in a single frame, only the top-most value would be recorded for the pixel (assuming no transparency is used). An animation WITH 100% transparency should keep the layer below it 100% unaffected.

 

Thank you in advance.

Layers.png

IAMK_PixelColour.au3

LookAtThese.png

Edited by IAMK

Share this post


Link to post
Share on other sites
rudi
Posted (edited)

Using this script I cannot reproduce your issue:

 

While 1
    $aMouse=MouseGetPos()
    $color=PixelGetColor($aMouse[0],$aMouse[1])
    $hex=Hex($color)
    $Red=StringMid($hex,3,2)
    $Grn=StringMid($hex,5,2)
    $Blu=StringRight($hex,2)
    $ToolTxt="Dec: " & $color& @CRLF & "Hex: " & $hex & @CRLF & @CRLF & _
    "Red  = " & $Red & " = " &  Dec($Red) & @CRLF & _
    "Green= " & $Grn & " = " & Dec($Grn) & @CRLF & _
    "Blue = " & $Blu &  " = " & Dec($Blu)

    ToolTip($ToolTxt,$aMouse[0]+30,$aMouse[1]+30)
    Sleep(100)
WEnd

regards, Rudi.

 

edit: Changed the sample script to show more details

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
IAMK

@rudi, I have tried your variation of the script, but I still have the same issue.

 

LookAtThese2.png

Share this post


Link to post
Share on other sites
JLogan3o13

@IAMK is this a game written in AutoIt?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
IAMK
Posted (edited)

@JLogan3o13, No. I'm the only person who uses AutoIT. It's written in c++.
The issue can be seen on this website as well (pictures attached).

p.s. I'm not trying to bot in a game (against rules). It's my company's game I am trying to automate a video record sequence for consistency and error avoidance.

Edited by IAMK

Share this post


Link to post
Share on other sites
IAMK

@JohnOne, You, my sir, are a champion.

I have no idea why DPI scaling would cause this issue. My screen was set to 125%. It seems the pixels stay as they are in the software, but my screen shifts the pixels before displaying them on the screen.

It works fine now.

  • Like 1

Share this post


Link to post
Share on other sites
TheXman

 

See if adding the A3Wrapper directive helps:

#AutoIt3Wrapper_Res_HiDpi=Y ;(Y/N) Compile for high DPI. Default=N
 

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

×