you need to use memblocks this function will help
Function pickColor(X,Y)
//color as integer
rem prepare image grab area
clearScreen()
setScissor(X,Y,X+1,Y+1)
render()
img = getImage(X,Y,X+1,Y+1)
rem create memblock
mem = createMemblockfromImage(img)
rem get memblock data
r = getMemblockbyte(mem,12):rem gets red channel data
g = getMemblockbyte(mem,13):rem gets green channel data
b = getMemblockbyte(mem,14):rem gets blue channel data
//a = getMemblockbyte(mem,15):rem gets alpha channel data
rem tidy up
deletememblock(mem)
deleteimage(img)
setScissor(0,0,getDeviceWidth(),getDeviceHeight())
clearScreen()
color = makeColor(r,g,b)
//color=0
endfunction color
then use these functions
integer GetColorRed( color )
integer GetColorGreen ( color )
integer GetColorBlue( color )