Get point color


int pixel(x y [window] [flags])



x y - coordinates.

window - top-level or child window. If omitted or literal 0, x and y are screen coordinates.


1 x y are relative to the top-left corner of window's client area or of the work area.
2 Don't activate window. Not error if point x y does not belong to window or its top-level parent window.
0x1000 QM 2.4.3. Get pixel color directly from window, not from screen. The same as scan flag 0x1000. It is faster. Does not activate window. Not error if x y does not belong to window; then returns -1 if the point is not in the window or client area rectangle. This flag is ignored if window not used or if Windows Aero theme is not enabled or window is DPI-scaled.



Returns pixel color.


When window is used:


Don't use this function to search for a pixel, because it is slow. Instead use scan (it can search for one or more pixel colors or images).


See also: wait for color, scan.



int w=win("Quick Macros" "QM_Editor")
int color=pixel(100 100 w 1|0x1000)
int r g b
ColorToRGB(color &r &g &b)
out F"color=0x{color} red={r} green={g} blue={b}"

 Store color from mouse pointer into the clipboard:
str s=F"0x{pixel(xm ym)}"