beetlebug▾
/

image get

A command of a photo: gives the color of one pixel.

IMAGENAME get X Y

Description

Gives the red, the green, and the blue of the pixel at X Y, each from 0 to 255. The pixel 0 0 is at the top left. A pixel with no color gives 0 0 0.

Returns

A list of three integers.

Examples

% image create photo g -width 2 -height 2
> g put #123456 -to 1 1
> g get 1 1
18 52 86

Errors

% image create photo g2 -width 2 -height 2; g2 get 5 5
g2 get: coordinates out of range
-errorcode NONE

% image create photo g3; g3 get 0
wrong # args: should be "g3 get x y"
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also