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


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.

LVL 11
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
dbrckoviAuthor Commented:
Perfect.    Thanks!
All Courses

From novice to tech pro — start learning today.