Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Get the amount of red, green and blue from given 32 bit pixel value.

HI!

Function RGB creates a color value based on given Red, Green and Blue values.

I need a function which will do the oposite:   extract amounts of Red, Green and Blue from color value created by GetPixel and RGB functions.

Thanks!
0
dbrckovi
Asked:
dbrckovi
1 Solution
 
EDDYKTCommented:
where color is RGB color

function GetRed(color)
      
On Error Resume Next
GetRed = color And &HFF
end Function

function GetGreen(color)
      
On Error Resume Next
GetGreen = ((color And &HFF00) / &H100) And &HFF
end Function

function GetBlue(color)
      
On Error Resume Next
GetBlue = ((color And &HFF0000) / &H10000) And &HFF
end Function
0
 
dbrckoviAuthor Commented:
Perfect.    Thanks!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now