refactor(xcf_stack): use explicit inputs for layer list and scheduling
Replace prior_steps and runs_last with inputs=[...] step refs so GIMP export waits only on listed layers. Add rezepttest pipeline and bokeh-oktagon recipe. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+28
-18
@@ -24,7 +24,7 @@ Not executable code. Named building blocks for creating or editing pipelines in
|
||||
```
|
||||
|
||||
6. **Shared expensive steps** — `rembg` runs once per pipeline and is reused. Recipe lines say `rembg`, but the agent must not re-run it for every composite.
|
||||
7. **`xcf_stack` (GIMP export)** — stacks **all prior step outputs** (plus `input/` by default) into one `.xcf` per image with layers named after step ids. Usually the **last step** after all composites. Requires `gimp` on PATH. Not a layer inside a `combine` block — a separate finishing recipe.
|
||||
7. **`xcf_stack` (GIMP export)** — stacks **listed step outputs** into one `.xcf` per image. Pass step refs in `inputs=[...]` (bottom layer → top). The runner waits until all listed steps finish. Requires `gimp` on PATH. Not a layer inside a `combine` block — a separate recipe.
|
||||
8. **Placeholders** — `COLOR1`, `COLOR2`, `COLOR`, `STYLE`, `MAX_EDGE`, `PROMPT`, `MODEL`, `TEMPLATE_IMAGE`, etc. are filled in at pipeline creation time (from your prompt or constants at the top of the script).
|
||||
9. **Colors** — hex for backgrounds (`#RRGGBB` or `#RRGGBBAA`). G'MIC filters need `R,G,B` tuples (see [GMIC color derivation](#6-gmic-color-derivation) below).
|
||||
10. **Single-step vs composite vs pipeline** — one declarative line = one module step. Multiple indented lines in a **composite** recipe = layers (bottom → top). Multiple indented lines in a **pipeline** recipe = sequential steps (first step first, output feeds the next).
|
||||
@@ -67,7 +67,7 @@ Not executable code. Named building blocks for creating or editing pipelines in
|
||||
- **Recipe inclusion:** if an indented line is a known recipe id (e.g. `colorsplash` inside `colorsplash-watermark`), look up that recipe, expand it, and use its output as the input for the next step. Expand recursively. Do not duplicate shared steps — one `rembg` (etc.) per pipeline when multiple included recipes need it.
|
||||
- **Pipeline vs composite:** multiple indented lines that are **sequential steps or recipe refs** = pipeline recipe (chain). Multiple indented **layer** lines (original, rembg, backgrounds, gmic-on-rembg, …) = composite recipe (combine). When unsure: if any line is another recipe id, treat the parent as a pipeline recipe.
|
||||
- **Ignore notes:** skip any line that is only a `#` comment (after indent trim). Strip inline `# …` suffixes on recipe-id lines. Do not copy note text into Python comments unless Fränky asks.
|
||||
- **`xcf_stack`:** when a pipeline includes recipe `xcf-stack` (or the user asks for GIMP layers), append as the final step: `p.step("xcf_stack", inputs="input")`. The module auto-collects `prior_steps` from the runner — do not list every composite as explicit inputs. See `imagepipeline/modules/xcf_stack.py`.
|
||||
- **`xcf_stack`:** list every layer source in `inputs=[...]` (bottom → top). Include `"input"` for the original. The runner schedules `xcf_stack` after all listed steps complete. See `imagepipeline/modules/xcf_stack.py` and `pipelines/pipeline_rezepttest.py`.
|
||||
- **Shared steps:** define `rembg` (and other expensive steps) **once** per pipeline and reference the step in composites — mirror `pipelines/pipeline_baxxter.py`.
|
||||
- Follow the **Rules cheat sheet** above — especially layer order and chained composites.
|
||||
- **3+ layers:** chain `composite` steps (see baxxter, crusaders, orange).
|
||||
@@ -87,14 +87,14 @@ Not executable code. Named building blocks for creating or editing pipelines in
|
||||
| `gradient background COLOR1 COLOR2 radial` | `imagemagick_fill` radial |
|
||||
| `COLOR background` | `imagemagick_fill` solid `color1=COLOR` |
|
||||
| `rembg with gmic: FILTER` | `gmic` on rembg output; command = `-FILTER` |
|
||||
| `original with gmic: FILTER` | `gmic` on input; command = `-FILTER` |
|
||||
| `layer opacity N%` | `composite` `foreground_opacity=N/100` on that layer |
|
||||
| `make layer 5% bigger then crop to original size` | `imagemagick_scale_crop` `scale=1.05` |
|
||||
| `COLOR to alpha` | `color_to_alpha` `color=COLOR` |
|
||||
| `resize max edge MAX_EDGE` | `imagemagick_resize` `max_edge=MAX_EDGE` |
|
||||
| `crop square` | `crop_square` |
|
||||
| `darktable style STYLE` | `darktable_style` `style=STYLE` |
|
||||
| `xcf stack all steps` | `xcf_stack` — GIMP layer export of all prior steps |
|
||||
| `xcf stack without input` | `xcf_stack` `include_input=false` |
|
||||
| `xcf stack layers: LAYER1, LAYER2, …` | `xcf_stack` with `inputs=[...]` in that order |
|
||||
| `xcf stack skip missing` | `xcf_stack` `skip_missing=true` |
|
||||
| `openrouter edit PROMPT MODEL` | `openrouter_edit` |
|
||||
| `openrouter gallery match TEMPLATE_IMAGE` | `openrouter_edit` with `template_image` |
|
||||
@@ -230,24 +230,15 @@ crop-square
|
||||
|
||||
```text
|
||||
xcf-stack # GIMP layer export — one .xcf per input image
|
||||
xcf stack all steps
|
||||
xcf stack layers: input, rembg, composite_01, composite_02, …
|
||||
```
|
||||
|
||||
- **Module:** `xcf_stack` — `p.step("xcf_stack", inputs="input")` as **last step**
|
||||
- **Layer order in XCF:** `input/` (bottom, default) then prior steps in pipeline definition order
|
||||
- **Module:** `xcf_stack` — `p.step("xcf_stack", inputs=["input", step_a, step_b, …])`
|
||||
- **Layer order in XCF:** same as `inputs` list (bottom → top); GIMP layer names = step ids (`input` for originals)
|
||||
- **Matching:** layers matched by filename stem (extension may differ, e.g. rembg `.png` on `.jpg` input)
|
||||
- **Output:** `{stem}.xcf` per input image
|
||||
- **Requires:** `gimp` on PATH
|
||||
- **No existing pipeline uses this yet** — append to any multi-output pipeline (e.g. baxxter variants + `xcf-stack`)
|
||||
|
||||
### xcf-stack-no-input
|
||||
|
||||
```text
|
||||
xcf-stack-no-input
|
||||
xcf stack without input
|
||||
```
|
||||
|
||||
- **Module:** `xcf_stack` — `include_input=False`
|
||||
- **Source:** `pipelines/pipeline_rezepttest.py`
|
||||
|
||||
### xcf-stack-skip-missing
|
||||
|
||||
@@ -461,6 +452,19 @@ original-jpr-smooth-rembg
|
||||
- **Middle layer:** jpr smooth on rembg, then scale 5% + center crop
|
||||
- **Source:** baxxter, crusaders
|
||||
|
||||
### bokeh-oktagon
|
||||
|
||||
```text
|
||||
bokeh-oktagon
|
||||
original
|
||||
original with gmic: fx_bokeh 3,5,0,30,8,4,0.3,0.2,R1,G1,B1,ALPHA1,0.7,30,20,20,1,2,R2,G2,B2,ALPHA2,0.15
|
||||
rembg
|
||||
```
|
||||
|
||||
- **3 layers:** composite(original, input_bokeh) → composite(result, rembg)
|
||||
- **Colors:** `R1,G1,B1` from **COLOR1**; `R2,G2,B2` from **COLOR2**; `ALPHA1` / `ALPHA2` are 0–255 (defaults 160 / 110)
|
||||
- **G'MIC:** octagonal bokeh discs — first color pair `R1,G1,B1,ALPHA1`, second `R2,G2,B2,ALPHA2`
|
||||
|
||||
### original-jpr-smooth-grey-alpha-rembg
|
||||
|
||||
```text
|
||||
@@ -556,6 +560,7 @@ G'MIC commands in parameterized recipes use **comma-separated RGB integers**, no
|
||||
| `original-bwrecolor-rembg` | highlight `R2,G2,B2`, accent `R1,G1,B1` in `fx_bwrecolorize` |
|
||||
| `rembg-custom-gradient-a` | starts with `R1,G1,B1`, transitions via `R2,G2,B2` |
|
||||
| `rembg-custom-gradient-b` | starts with `R2,G2,B2`, transitions via `R1,G1,B1` |
|
||||
| `bokeh-oktagon` | bokeh tints `R1,G1,B1,ALPHA1` and `R2,G2,B2,ALPHA2` in `fx_bokeh` |
|
||||
| `imagemagick_fill` backgrounds | use full hex including alpha if needed (`#d7fd00ff`) |
|
||||
|
||||
### Agent workflow
|
||||
@@ -596,7 +601,12 @@ colorsplash-watermark
|
||||
Create pipeline "foo" with recipes colorsplash, rembg-radial-2colors, and xcf-stack
|
||||
```
|
||||
|
||||
Agent: all composite outputs first, then `p.step("xcf_stack", inputs="input")` as the final step.
|
||||
Agent: build all composite steps, then `p.step("xcf_stack", inputs=["input", rembg_out, …, composite_final])` listing every layer bottom → top.
|
||||
|
||||
```text
|
||||
xcf-stack
|
||||
xcf stack layers: input, rembg, composite_colorsplash, composite_radial, …
|
||||
```
|
||||
|
||||
### Full combine list (baxxter style)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user