Get Hue, Saturation, Intensity of a Pixel

Q:  How can I retrieve the hue, saturation, and intensity values of a pixel?

A:  If you want to know the hue, saturation or intensity of a pixel, you can easily retrieve them by using BiImage.ocx. There are many color conversion methods to convert an RGB pixel to other color space including HSI. If you have a device independent bitmap, you can get the RGB color of a pixel with GetDIBPixelColor method of the BiDib.ocx and then convert it to HIS as demonstrated below.

 

Code example:

Dim hue as integer

Dim saturation as integer

Dim intensity as integer

BiImage.RGBtoHSI red, green, blue, hue, saturation, intensity