@IMGCOLOR — Returns the color of a pixel in an image file.

Syntax:
%@IMGCOLOR[filename,position]
%@IMGCOLOR[filename,x,y]

filenamethe image file to examine
positionwhich pixel’s color to return:
   1 — the top left
   2 — the top center
   3 — the top right
   4 — the center left
   5 — the center of the image
   6 — the center right
   7 — the bottom left
   8 — the bottom center
   9 — the bottom right
x,ythe coordinates of the pixel to return

The filename specifies a graphics file with an extension of .BMP, .JPG, .JPEG, .PNG, .GIF, .TIF, or .TIFF. Directory aliases are supported in filename.

If you do not specify a position or x,y coordinates, the default is to grab the pixel at the center. The x and y values may be decimal, or hexadecimal with a leading 0x. If x is negative, it is interpreted as pixels from the right edge; a negative y is pixels up from the bottom.

The selected pixel’s color is returned as a six-digit hexadecimal value, #rrggbb; for example, #5b6d85. It can be used as the color argument to the BGCOLOR command.

rem  Set the background color to match the wallpaper:
if "%_wallpaper" ne "*none*" bgcolor %@imgcolor["%_wallpaper"]


See also: the BGCOLOR command, which sets the background color; the @RGBCOMPL function, which returns a complementary color; and the @RGBLUM function, which returns a luminance value for a given color.