#include gpImage.h If Not "gpImage" $ Set("Procedure") Set Procedure To gpImage Additive EndIf gdip = CreateObject("gpInit") img = CreateObject("gpImage") ** Loading Image lcFile = GetPict("jpg;gif;bmp") img.Load(lcFile) ** To get the selected color ? img.GetPixelColor(0, 0)I always like to close the objects after using them, to minimize the use of memory and handles
img = NULL gdip = NULLWith these functions you can have the individual components of the RGB color :
FUNCTION GetRed(tnColor) RETURN BITAND(tnColor, 0x000000FF) ENDFUNC
FUNCTION GetGreen(tnColor) RETURN BITRSHIFT(BITAND(tnColor, 0x0000FF00), 8) ENDFUNC
FUNCTION GetBlue(tnColor) RETURN BITRSHIFT(BITAND(tnColor, 0x00FF0000), 16) ENDFUNCYou can have also a look at an enhanced version of this class at