Jump to content
Macro Express Forums

Pixel Color Ranges


Peter1

Recommended Posts

I'm wanting to detect whether a bar is full or not. Just using get pixel won't work because the bar has a gradient shading, color changes with angle, and its semi transparent. So is the shade is more or less constantly changing. I guess this means I'll have to detect a range of shades. Ive looked around on the forum and found a fellow who was wanting to do the exact same thing I am. Kevin did reply with a proposed soultion but the poster never replied back to say whether it worked. His soultion was to get interger returned by get pixel into RGB values.

 

// Get pixel color
Get Pixel: Under Mouse into %N10%
Variable Modify Integer: Copy %N10% to %N1%
Variable Modify Integer: Convert %N1% to decimal %D1%

// Get Red value
Variable Modify Decimal: %D1% = %D1% / 256
Variable Modify Decimal: Copy fraction part of %D1% to %D11%
Variable Modify Decimal: %D11% = %D11% * 256

// Get Green value
Variable Modify Decimal: Truncate %D1% to integer %N1%
Variable Modify Integer: Convert %N1% to decimal %D1%
Variable Modify Decimal: %D1% = %D1% / 256
Variable Modify Decimal: Copy fraction part of %D1% to %D12%
Variable Modify Decimal: %D12% = %D12% * 256

// Get Blue value
Variable Modify Decimal: Truncate %D1% to integer %N1%
Variable Modify Integer: Convert %N1% to decimal %D13%

// Here:
//     D11 = Red
//     D12 = Green
//     D13 = Blue

Text Box Display: Result

http://pgmacros.invisionzone.com/index.php?showtopic=1280&hl=colors

 

The thing that I'm not getting is the "Variable Modify Decimal: Copy fraction part " commands. I don't see the copy fraction part under Variable Modify Decimal. I tried just doing a regular copy but the results for red and green returned more digits then 3. So this leads me to believe the copy fraction part is hiding frome me, or perhaps this command has changed to some other place/no longer exists in macro express since the thread is well over a year old.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...