Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I separate colors from 0xA0FF0B04 to Red, Green and Blue?

Status
Not open for further replies.

fayevalentine

Programmer
Jun 2, 2004
38
MX
I want to know if there is a way to read just green color from a image?

Thank you.
 
If you mask the data and shift.
I am presuming green is the FF in your example.
//Make bitmask of 1's where you want to keep the bits, make rest 0's
foo= 0xA0FF0B04 & 0x00FF0000
// then shift appropriate bit positions to get down to a standard integral number.
green=foo >> 16;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top