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!
LVL 11
dbrckoviAsked:
Who is Participating?
 
EDDYKTConnect With a Mentor Commented:
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
All Courses

From novice to tech pro — start learning today.