generate_mask
Generates a deterministic grayscale mask from a reference image, defining gradient, luminosity, or color ranges to selectively apply subsequent image operations.
Instructions
Generate a deterministic grayscale mask as a new PNG revision, with exactly the
dimensions of reference_revision_id. kind is "linear_gradient" (angle_degrees,
start, end), "radial_gradient" (center_x, center_y, radius, feather),
"luminosity_range" (min, max, feather) or "color_range" (hue_center, hue_width,
feather); the gradients use only the reference's dimensions, the other two compute
weights from its pixels. White = the masked operation applies fully, black = not at
all. Reference the returned revision_id from any tone/filter operation as
"mask": {"revision_id": "rev_...", "invert": false, "feather_px": 0}, or visualise it
with render_preview overlay="mask". Idempotent: the same params over the same
reference produce byte-identical PNG bytes and return the existing revision.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | linear_gradient: 軸上で重みが 0.0 に達する位置(0..1、`start` 以上)。既定 1.0。 | |
| max | No | luminosity_range: 完全に選択される輝度域の上限(0..255、`min` 以上)。既定 255。 | |
| min | No | luminosity_range: 完全に選択される輝度域の下限(0..255)。既定 0。 | |
| kind | Yes | `"linear_gradient"` | `"radial_gradient"` | `"luminosity_range"` | `"color_range"`。 | |
| start | No | linear_gradient: 軸上で重みが 1.0 のままでいる終端位置(0..1)。既定 0.0。 | |
| radius | No | radial_gradient: 重みが 1.0 の内円の半径(対角線の半分に対する比 0..1)。既定 0.5。 | |
| feather | No | 減衰帯の幅。radial_gradient では対角線の半分に対する比(0..1、既定 0.25)、 luminosity_range では輝度単位(0..255、既定 16)、 color_range では色相の度数(0..180、既定 15)。linear_gradient では使わない (`start`/`end` の間隔がフェザそのもの)。 | |
| center_x | No | radial_gradient: 中心の X(画像幅に対する相対値 0..1)。既定 0.5。 | |
| center_y | No | radial_gradient: 中心の Y(画像高に対する相対値 0..1)。既定 0.5。 | |
| hue_width | No | color_range: 中心からの**片側**幅(度、1..180)。既定 30。 | |
| hue_center | No | color_range: 中心色相(度、0..360)。必須。 | |
| angle_degrees | No | linear_gradient: グラデーション軸の角度(度)。0 = 上が白で下へ向かって黒、 90 = 左が白で右へ向かって黒(正の角度で時計回り)。既定 0。 | |
| reference_revision_id | Yes | 寸法(と、輝度/色域マスクでは画素)の供給元になる画像 revision ID。 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | 生成した種別(`linear_gradient` 等)。 | |
| next | Yes | 次の一手(op への参照の仕方)。 | |
| width | Yes | ||
| height | Yes | ||
| reused | Yes | 同じマスクが既に生成済みで既存 revision を返した場合 true(冪等ヒット)。 | |
| revision | Yes | ||
| generator | Yes | 既定値まで解決したパラメータの正規化 JSON(origin の generator と同一文字列)。 | |
| mean_weight | Yes | マスクの平均重み(0..1)。1 に近いほど広く、0 に近いほど狭い被覆。 | |
| reference_revision_id | Yes | 参照した画像 revision(寸法・画素の供給元)。 |