#!/usr/bin/env bash # # build.sh: the images for "Drunk in Paris" # # A night of French gothic romance, named after the short Type O Negative track on # "Life Is Killing Me" (2003): ten chapters of three paintings each, thirty couples in all. The # scenes are sensual but not explicit, they are original inventions, and every figure is an # invented adult. # # Track: https://typeonegative.fandom.com/wiki/Drunk_in_Paris # Model: https://replicate.com/black-forest-labs/flux-3-image # # Settings: # Prompt plain, detailed sentences; web grounding is switched off so the model invents its # own faces and imagery # Size 2:3 portrait throughout; add `wide -` below for a 3:2 spread # # Usage: ./build.sh [options] (REPLICATE_API_TOKEN must be set) # -p, --part N[,N...] only these chapters (1-10) # -k, --shot N[,N...] only these paintings (1-3) # -r, --resolution RES 768sq, 1k, 1.5k, 2k or 4k (default 1.5k) # -j, --jobs N parallel predictions (default 4) # -f, --force render paintings that already exist # -n, --dry-run print the prompts and payloads, generate nothing # -h, --help # # Output: drunk-in-paris--.jpg next to this file. # FLUX 3 has no seed input, so a rerun gives new takes on the same prompts; keep the images you # like, they are skipped. When all 30 exist, the post's `draft` flag is cleared. set -Eeuo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROSE="${ROSE_PY:-$HERE/../../../rose.py}" MODEL="black-forest-labs/flux-3-image" RESOLUTION="1.5k" PORTRAIT="2:3" LANDSCAPE="3:2" JOBS=4 FORMAT="jpg" QUALITY=92 FORCE=0 DRY=0 PART_ONLY="" SHOT_ONLY="" PARTS=10 SHOTS=3 # --------------------------------------------------------------------------------------- # The look, reused in every prompt # --------------------------------------------------------------------------------------- STYLE="A luminous, romantic digital oil painting in a French gothic style, with a polished concept \ art finish, rich brushwork, deep shadows, crimson and plum accents, and Belle Epoque Paris detail." CLOSING="The mood is sensual, tender and elegant, with no nudity. Beautiful faces, natural \ anatomy and graceful hands. A single full-bleed painting without text, lettering or borders." FF="Two adult women in their thirties, a couple." MF="A woman and a man, both adults in their thirties, a couple." # --------------------------------------------------------------------------------------- # Ten chapters, three paintings each. shot "" # `wide ...` renders those as landscape spreads # --------------------------------------------------------------------------------------- declare -A PAIR SCENE WIDE shot() { PAIR["$1-$2"]=$3; SCENE["$1-$2"]=$4; } wide() { local key; for key in "$@"; do WIDE["$key"]=1; done; } # I. L'Apéritif shot 1 1 FF "They sit close at a round marble table on a Paris cafe terrace at night, foreheads \ touching, eyes locked, red lips slightly parted. One has long ink-black hair, the other auburn \ curls, both in black lace dresses. Two glasses of red wine, gas street lamps, fine rain falling \ beyond the awning." shot 1 2 MF "Across a marble cafe table he lifts her hand to his lips while she watches him with \ half-closed eyes and a slow smile. She wears a crimson corset gown and long wavy black hair, he a \ black frock coat. Candle, wine, the Eiffel Tower glowing in the night behind them." shot 1 3 FF "In a candlelit cafe booth she playfully holds a sugar cube to her companion's lips \ over two glasses of emerald absinthe. Platinum blonde finger waves and a jet black bob, velvet \ gowns in bottle green and black, a green glow on their faces." # II. Montmartre shot 2 1 FF "They embrace halfway up a steep stone stairway in Montmartre at night, noses \ touching. Red curls and long silver hair, long black coats open over lace dresses. An old iron \ street lamp, wet steps, mist, the white domes of Sacre-Coeur above them." shot 2 2 MF "In a candlelit attic studio a painter in a loose white shirt gently lifts the chin of \ his model, who is wrapped in draped burgundy silk with bare shoulders. An easel with her portrait, \ candles, a tall arched window over moonlit rooftops." shot 2 3 FF "In an artist's attic one traces the jawline of the other with a paint-stained finger, \ their faces very close. A dark-skinned woman with cropped curls and a pale woman with long dark \ hair, ivory silk slip dress and black lace robe. Canvases, candlelight, moonlit window." # III. Le Chat Noir shot 3 1 FF "In a cabaret dressing room one stands behind the other, fastening a black velvet \ choker around her neck and brushing her ear with her lips; both are reflected in a gilded mirror \ ringed with warm bulbs. Black corsets, feather boas, lipsticks on the vanity." shot 3 2 FF "They recline together on a red velvet chaise longue, almost kissing. Black finger \ waves and wine red hair, black and scarlet sequin gowns, long satin gloves. A sleek black cat \ watches from the armrest, red curtains, drifting smoke." shot 3 3 MF "A passionate tango on a small cabaret stage, faces a breath apart, her leg wrapped \ elegantly in the slit of a black sequin gown, his tuxedo bow tie hanging loose. A single red \ spotlight, velvet curtains, smoke." # IV. L'Opéra shot 4 1 MF "Masked, they waltz through a gilded baroque ballroom, lips almost touching behind \ black lace masks. A black and crimson gown swirls around his black tailcoat. Crystal chandeliers, \ candlelight, blurred dancers far behind." shot 4 2 FF "In a private red velvet opera box one lowers her lace mask to whisper into the other's \ ear, who closes her eyes and smiles. Midnight blue and emerald ball gowns, long black opera \ gloves, champagne coupes, candlelight." shot 4 3 FF "They slow dance on the grand marble staircase of the Paris opera house, one's hand on \ the other's open back. Black silk and ivory silk gowns with long trains, venetian masks, bronze \ candelabra." # V. La Seine shot 5 1 MF "They kiss beneath a black umbrella on an old stone bridge over the Seine in pouring \ rain. Her red dress is the only bright colour, he wears a long dark coat. Street lamps reflected \ in the wet cobbles and the river, Notre-Dame in the mist." shot 5 2 FF "On the stone quay of the Seine two women dance in each other's arms, laughing, wet \ hair and long black chiffon gowns caught by the wind, the full skirts sweeping the ground and \ completely covering their legs and feet, a wine bottle left on the stones. Moonlight on the water, \ the Pont Alexandre III behind them." shot 5 3 FF "Wrapped together in one deep red velvet cloak they sit on the bank of the Seine, cheek \ to cheek, eyes closed. An auburn braid and a short black bob. A lantern beside them, a misty stone \ bridge, the Eiffel Tower far away." # VI. La Galerie shot 6 1 FF "A stolen kiss between two white marble statues in a dim museum gallery. Black lace \ blouses and long skirts, one with her hair pinned up, one with it falling loose. Huge gilded \ frames, a shaft of moonlight from a tall window." shot 6 2 MF "Pressed close between tall shelves of an antique Paris bookshop at night, she with \ black hair and round spectacles, he with a short beard, their eyes locked, her hand on his \ waistcoat. A single candle, old leather books, a library ladder." shot 6 3 FF "In a glass roofed Parisian covered passage at night she draws the other close by the \ ribbon of her choker, both smiling softly. An East Asian woman with long straight black hair and \ a redhead, silk evening dresses, glowing globe lamps, a mosaic floor." # VII. Le Carrosse shot 7 1 MF "Inside a horse drawn carriage with red velvet seats they sit close and share a gentle \ kiss, her long black Victorian gown and his black frock coat and cravat, her gloved hand resting \ on his lapel. Street lamps pass by the rain streaked window." shot 7 2 FF "In a velvet lined carriage at night one rests her head on the other's bare shoulder, \ eyes closed, their gloved fingers intertwined. Black fur stoles, lace gloves, a champagne bottle, \ the lights of a boulevard through the window." shot 7 3 FF "Beside a black carriage before a baroque Paris mansion, one bows to kiss the inside of \ the other's wrist as she steps down. Long black and burgundy trains, wet cobbles, a black horse, \ lanterns in the fog." # VIII. La Cave shot 8 1 FF "In a vaulted stone wine cellar by candlelight they share one glass of red wine, a drop \ on her lower lip that the other is about to wipe away with her thumb. Black leather corsets with \ lace sleeves, smouldering eyes, old barrels." shot 8 2 MF "She leans back against an oak barrel in a candlelit cellar, eyes closed, as he kisses \ her neck. Long red hair, a dark green velvet gown slipping from one shoulder, his black waistcoat \ and rolled sleeves. Dusty bottles and dripping candles." shot 8 3 FF "In a candlelit stone alcove they sit knee to knee in black and wine red silk robes, \ hands intertwined, faces close. One has black hair with a white streak, the other honey blonde \ waves. Dark red roses, dripping wax." # IX. Les Toits shot 9 1 MF "Sitting close on a zinc Paris rooftop among chimney pots, sharing a bottle of wine, \ they kiss under a starry sky. Her black lace dress, his open white shirt, the Eiffel Tower \ glowing in the distance." shot 9 2 FF "On a wrought iron balcony at night she holds the other from behind and kisses her \ bare shoulder; the other leans back with closed eyes. Satin slip dresses and a sheer black robe, \ Haussmann facades, the Eiffel Tower, a full moon." shot 9 3 FF "Two elegant women in their fifties, one with silver hair and one with black, touch \ foreheads on a rooftop terrace, smiling tenderly, champagne coupes in hand. Velvet gowns, a huge \ moon over the domes of Paris." # X. L'Aube shot 10 1 FF "Waking in a Paris boudoir at dawn, they lie face to face under rumpled ivory satin \ sheets drawn up to their shoulders, noses touching, with sleepy smiles and tangled hair. Rose \ petals on the pillow, lace straps, a tall window with pale light." shot 10 2 FF "Lips almost touching, eyes closed, they lean over a pale marble cafe table at dawn. \ One has long ink-black hair and black lace, the other wine red hair and a jewelled choker. A \ crystal carafe of red wine, glasses and fallen dark red roses in front, a tall arched window with \ Paris rooftops, soft clouds and a plum velvet curtain behind." shot 10 3 MF "At the open balcony doors at dawn she wears his white shirt over a black slip, he \ holds her by the waist from behind, cheek to cheek. Coffee cups, a pink and violet sky over the \ rooftops of Paris and the Eiffel Tower." # 9-3 shows an older couple, so it brings its own description PAIR["9-3"]=SELF # --------------------------------------------------------------------------------------- # Helpers # --------------------------------------------------------------------------------------- if [[ -t 2 ]]; then B=$'\033[1m' D=$'\033[2m' R=$'\033[31m' G=$'\033[32m' Y=$'\033[33m' Z=$'\033[0m' else B="" D="" R="" G="" Y="" Z="" fi say() { printf '%s\n' "$*" >&2; } die() { say "${R}error:${Z} $*"; exit 2; } usage() { sed -n '/^# Usage:/,/^# -h/p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; } squash() { tr -s '[:space:]' ' '; } file_of() { printf '%s/drunk-in-paris-%d-%d' "$HERE" "$1" "$2"; } # chapter painting -> path, no extension have() { compgen -G "$(file_of "$1" "$2").*" >/dev/null; } shot_prompt() { # chapter-painting -> one-line prompt local who="" case ${PAIR[$1]} in FF) who="$FF" ;; MF) who="$MF" ;; esac printf '%s %s %s %s' "$STYLE" "$who" "${SCENE[$1]}" "$CLOSING" | squash } result() { # out_dir index -> the file rose.py saved for that prompt, if any find "$1" -maxdepth 1 -type f -name "*-$(printf '%02d' "$2").*" 2>/dev/null | head -n1 || true } # --------------------------------------------------------------------------------------- # Options # --------------------------------------------------------------------------------------- while (($#)); do case "$1" in -p | --part) PART_ONLY="${2:?--part needs a value}"; shift 2 ;; -k | --shot) SHOT_ONLY="${2:?--shot needs a value}"; shift 2 ;; -r | --resolution) RESOLUTION="${2:?--resolution needs a value}"; shift 2 ;; -j | --jobs) JOBS="${2:?--jobs needs a value}"; shift 2 ;; -f | --force) FORCE=1; shift ;; -n | --dry-run) DRY=1; shift ;; -h | --help) usage; exit 0 ;; *) die "unknown option: $1 (try --help)" ;; esac done [[ -f "$ROSE" ]] || die "rose.py not found at $ROSE (set ROSE_PY)" command -v python3 >/dev/null || die "python3 is required" [[ -n "${REPLICATE_API_TOKEN:-}" ]] || die "REPLICATE_API_TOKEN is not set" if [[ -n "$PART_ONLY" ]]; then IFS=',' read -r -a WANT <<<"$PART_ONLY" for n in "${WANT[@]}"; do [[ "$n" =~ ^([1-9]|10)$ ]] || die "chapter must be 1-10, got '$n'"; done else WANT=(1 2 3 4 5 6 7 8 9 10) fi if [[ -n "$SHOT_ONLY" ]]; then IFS=',' read -r -a SHOT_WANT <<<"$SHOT_ONLY" for n in "${SHOT_WANT[@]}"; do [[ "$n" =~ ^[1-3]$ ]] || die "painting must be 1-3, got '$n'"; done else SHOT_WANT=(1 2 3) fi TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT failed=0 say "${B}Drunk in Paris${Z} ${D}${MODEL} · ${RESOLUTION}${Z}" # --------------------------------------------------------------------------------------- # One batch per format, so each gets its aspect ratio # --------------------------------------------------------------------------------------- for format in portrait landscape; do todo=() for m in "${WANT[@]}"; do for k in "${SHOT_WANT[@]}"; do is=portrait [[ -n "${WIDE[$m-$k]:-}" ]] && is=landscape [[ $is == "$format" ]] || continue if ((FORCE || DRY)) || ! have "$m" "$k"; then todo+=("$m $k"); fi done done ((${#todo[@]})) || continue aspect="$PORTRAIT" [[ $format == landscape ]] && aspect="$LANDSCAPE" say "" say "${B}${format}${Z} ${D}(${#todo[@]} painting(s), ${aspect})${Z}" prompts="$TMP/$format.txt" : >"$prompts" for item in "${todo[@]}"; do read -r m k <<<"$item" shot_prompt "$m-$k" >>"$prompts" printf '\n' >>"$prompts" done args=(replicate "$MODEL" --prompts-file "$prompts" --jobs "$JOBS" --timeout 900 --aspect-ratio "$aspect" --resolution "$RESOLUTION" --no-grounding --output-format "$FORMAT" --output-quality "$QUALITY" --output-dir "$TMP/$format" --no-meta) ((DRY)) && args+=(--dry-run) if ! python3 "$ROSE" "${args[@]}"; then say "${Y}some paintings failed, rerun to retry them${Z}" failed=1 fi ((DRY)) && continue i=0 for item in "${todo[@]}"; do i=$((i + 1)) read -r m k <<<"$item" src="$(result "$TMP/$format" "$i")" [[ -n "$src" ]] || continue mv -f "$src" "$(file_of "$m" "$k").${src##*.}" say "${G}saved${Z} drunk-in-paris-$m-$k.${src##*.}" done done # --------------------------------------------------------------------------------------- # Publish the post once everything exists # --------------------------------------------------------------------------------------- if ((!DRY)); then missing=0 for ((m = 1; m <= PARTS; m++)); do for ((k = 1; k <= SHOTS; k++)); do have "$m" "$k" || missing=$((missing + 1)); done done if ((missing)); then say "${Y}${missing} painting(s) still missing.${Z}" elif [[ -f "$HERE/index.md" ]] && grep -q '^draft: true$' "$HERE/index.md"; then sed -i 's/^draft: true$/draft: false/' "$HERE/index.md" say "${G}All $((PARTS * SHOTS)) paintings exist: draft flag cleared in index.md.${Z}" fi fi exit "$failed"