Add layer mask
gimp_add_layer_maskAdd a non-destructive mask to a GIMP layer or group using a white, black, alpha, selection, or grayscale fill, optionally inverted, while keeping the layer's pixels intact.
Instructions
Add a mask to a layer or group. fill: 'white' (everything visible), 'black' (everything hidden), 'alpha' (from the layer's transparency), 'selection' (selected = visible; EMPTY_SELECTION if nothing is selected), 'grayscale' (from the layer's luminance). invert inverts it. Non-destructive: the layer's pixels are kept.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"item": "<item>"
},
"name": "gimp_add_layer_mask"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fill | No | white | |
| item | Yes | Item id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'. | |
| invert | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | Offset of the layer's top-left corner in image pixels. | |
| y | Yes | ||
| id | Yes | ||
| kind | Yes | ||
| mask | Yes | ||
| mode | Yes | GIMP layer mode nick, e.g. 'normal', 'multiply'. | |
| name | Yes | Layer name. GIMP keeps names unique within an image ('Title #1'). | |
| locks | Yes | ||
| width | Yes | ||
| height | Yes | ||
| parent | Yes | Id of the parent group, null at the top level. | |
| opacity | Yes | 0-100. | |
| visible | Yes | ||
| children | No | Child layers of a group, top-most first; null for non-groups. | |
| has_alpha | Yes |