diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-23 13:58:18 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-23 13:58:18 +0200 |
| commit | 2b2e8a0ea6345cbf16741154dc326bf8c7ba312a (patch) | |
| tree | 8991e06939e940319984f836d699890f91b27f1d /desktop/companion/gen-frames | |
| parent | 14a2c755d6b4488c8572dcfa5d64f673fae9cedc (diff) | |
| download | quickshell-2b2e8a0ea6345cbf16741154dc326bf8c7ba312a.tar.gz quickshell-2b2e8a0ea6345cbf16741154dc326bf8c7ba312a.zip | |
companion: the dress set, a shoved frame, several references per frame
The dress frames are made. What the tries taught is in frames.txt beside
each line: klein turns the blindfold into an eye mask under strong
expressions, so those take it off (BARE) and the rest name it as one solid
band (EYES); standing "shoved" read as walking in four seeds, so it is
airborne, edited from the seed-7 attempt kept in candidates/; a back view
fits "watch", her watching the screen while the user types; klein would
neither draw the game's Virtuous Treaty nor move a sword, nor turn her
three-quarters, so muse takes only the arms of her official art.
gen-frames now takes several references per frame (a + b): the first is
edited, the rest are images the prompt points at. The leotard set loses
the blindfold too. shoved gets a frame of its own instead of mad: in the
spec's table and the plan's Mood.js and its test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/companion/gen-frames')
| -rwxr-xr-x | desktop/companion/gen-frames | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/desktop/companion/gen-frames b/desktop/companion/gen-frames index 75e6655..df78cb9 100755 --- a/desktop/companion/gen-frames +++ b/desktop/companion/gen-frames @@ -44,10 +44,12 @@ while (($#)); do esac done -# frames.txt to "output<TAB>reference<TAB>prompt" lines, variables expanded. +# frames.txt to "output<TAB>references<TAB>prompt" lines, variables expanded. +# References are joined with + and no spaces: the first is the image edited, +# any after it are extra images the prompt can point at ("the second image"). parse() { local line name out ref prompt - local frame='^[[:space:]]*([a-z0-9/_-]+)[[:space:]]*<-[[:space:]]*([a-z0-9/_-]+)[[:space:]]*:[[:space:]]*(.*)$' + local frame='^[[:space:]]*([a-z0-9/_-]+)[[:space:]]*<-[[:space:]]*([a-z0-9/_-]+([[:space:]]*\+[[:space:]]*[a-z0-9/_-]+)*)[[:space:]]*:[[:space:]]*(.*)$' declare -A vars=() while IFS= read -r line || [[ -n $line ]]; do [[ $line =~ ^[[:space:]]*(#|$) ]] && continue @@ -59,7 +61,7 @@ parse() { echo "gen-frames: frames.txt: cannot read: $line" >&2 exit 1 fi - out=${BASH_REMATCH[1]} ref=${BASH_REMATCH[2]} prompt=${BASH_REMATCH[3]} + out=${BASH_REMATCH[1]} ref=${BASH_REMATCH[2]// /} prompt=${BASH_REMATCH[4]} for name in "${!vars[@]}"; do prompt=${prompt//\$\{$name\}/${vars[$name]}}; done if [[ $prompt == *'${'* ]]; then echo "gen-frames: frames.txt: $out: undefined variable in: $prompt" >&2 @@ -106,16 +108,22 @@ trap 'rm -rf "$tmp"' EXIT made=0 for row in "${todo[@]}"; do IFS=$'\t' read -r out ref prompt <<<"$row" - if [[ ! -e $art/$ref.png ]]; then - echo "gen-frames: $out: its reference $ref.png does not exist yet, skipped" >&2 + IFS=+ read -ra refs <<<"$ref" + missing="" + for r in "${refs[@]}"; do [[ -e $art/$r.png ]] || missing=$r; done + if [[ -n $missing ]]; then + echo "gen-frames: $out: its reference $missing.png does not exist yet, skipped" >&2 continue fi - echo "gen-frames: $out <- $ref" - { printf 'data:image/png;base64,'; base64 -w0 "$art/$ref.png"; } >"$tmp/ref" + echo "gen-frames: $out <- ${ref//+/ + }" + # One JSON string per reference, as data URLs, slurped into the array. + for r in "${refs[@]}"; do + { printf 'data:image/png;base64,'; base64 -w0 "$art/$r.png"; } | jq -Rs . + done >"$tmp/refs.json" # The settings the frames were tuned with in sd-webui: recipe.txt. - jq -n --arg prompt "$prompt" --rawfile ref "$tmp/ref" --argjson seed "$seed" '{ + jq -n --arg prompt "$prompt" --slurpfile refs "$tmp/refs.json" --argjson seed "$seed" '{ prompt: $prompt, negative_prompt: "", width: 1024, height: 1024, seed: $seed, - batch_count: 1, ref_images: [$ref], auto_resize_ref_image: true, + batch_count: 1, ref_images: $refs, auto_resize_ref_image: true, increase_ref_index: false, lora: [], output_format: "png", output_compression: 100, sample_params: { sample_steps: 4, sample_method: "euler", scheduler: "default", guidance: { txt_cfg: 1.0 } } |
