| x | No | rectangle/ellipse/magic_wand, or color_range's sample point: left edge or point x, in image pixels from the canvas origin, also when `layer` names a layer that sits at an offset (never counted from that layer's own corner). | |
| y | No | rectangle/ellipse/magic_wand, or color_range's sample point: top edge or point y, in image pixels from the canvas origin, also when `layer` names a layer that sits at an offset (never counted from that layer's own corner). | |
| cx | No | gradient_radial: center x, document pixels. Default the image's own center. | |
| cy | No | gradient_radial: center y, document pixels. Default the image's own center. | |
| x1 | No | gradient_linear: start point x, document pixels. Default 0. | |
| x2 | No | gradient_linear: end point x, document pixels. Default the image's width. | |
| y1 | No | gradient_linear: start point y, document pixels. Default 0. | |
| y2 | No | gradient_linear: end point y, document pixels. Default 0. | |
| mode | Yes | rectangle/ellipse: x, y, width, height. polygon: points (>=3 [x,y] pairs). color_range: every pixel near `color` (hex) or the colour at a sample point x,y, anywhere in the image. magic_wand: the contiguous region around x,y. alpha: a layer's opaque pixels. channel: copy another saved selection (`source`). gradient_linear: a ramp from (x1,y1) to (x2,y2), default the full image width. gradient_radial: a ramp from full effect at the center (cx,cy) fading to none at radius, default centered at the image's own center with radius = half the shorter side. | |
| name | No | Channel to save the selection in (replaced). | Selection |
| color | No | color_range: a hex colour like "#c0392b". | |
| image | Yes | Image id, as returned by open_photo. | |
| layer | No | Layer name. Defaults to the selected layer, or the topmost layer if none is selected. alpha: which layer. color_range/magic_wand: only matters when sample_merged:false (otherwise the visible composite is sampled, and which layer this names makes no difference to the result). | |
| width | No | rectangle/ellipse: width, document pixels. | |
| height | No | rectangle/ellipse: height, document pixels. | |
| invert | No | Applied to the NEW shape alone, before any `combine`. rectangle/ellipse/polygon/color_range/magic_wand/alpha/channel: invert the selection. gradient_linear/gradient_radial: swap which end is black vs white. | |
| points | No | polygon: 3-10,000 [x, y] pairs, document pixels. | |
| radius | No | gradient_radial: radius, document pixels. Default half the shorter image side. | |
| source | No | mode=channel: the saved selection to copy. | |
| combine | No | Combine with the existing saved selection of the same `name` (like shift/alt in a GUI). `invert`/`feather_px` apply to the NEW shape alone, before it is combined. | replace |
| layer_id | No | Layer id, as inspect (and any tool that creates a layer) reports it. Takes priority over `layer`, and is the only way to address one of two layers that share a name. alpha: which layer. color_range/magic_wand: only matters when sample_merged:false. | |
| threshold | No | color_range/magic_wand tolerance, 0-255. | |
| feather_px | No | Feather radius in document pixels, applied to the NEW shape alone before any `combine`. Refused (nonzero) on gradient_linear/gradient_radial -- already a continuous ramp, nothing to feather. | |
| sample_merged | No | color_range/magic_wand: sample the visible composite. false samples the one named/selected layer's own raw pixels instead. | |