Skip to content
Python

face-swap: the face oval as found, and keep the photo's hairline

neuregexa533f6822108
diff --git a/apps/face-swap/app.json b/apps/face-swap/app.json
index 5085f93..e1299ba 100644
--- a/apps/face-swap/app.json
+++ b/apps/face-swap/app.json
@@ -11,7 +11,7 @@
"source": {
"template": "image_flux3_klein_distilled_image_edit.json",
"comfyui": "0.42.0",
- "notes": "Template app written by tools/template_apps.py: the workflow is apps/edit's (built by tools/build_apps.py) plus a second LoadImage on ReferenceMultiLatent's images.image1; the sampler starts from the first image (scaled to 1 MP, encoded) with a noise mask on the face oval that the native MediaPipe nodes find, grown by 16 px, so only the face is redrawn, and the second image is Klein's only reference; the prompt below is fixed and \"Extra direction\" is appended to it."
+ "notes": "Template app written by tools/template_apps.py: the workflow is apps/edit's (built by tools/build_apps.py) plus a second LoadImage on ReferenceMultiLatent's images.image1; the sampler starts from the first image (scaled to 1 MP, encoded) with a noise mask on the face oval that the native MediaPipe nodes find, so only the face is redrawn, and the second image is Klein's only reference; the prompt below is fixed and \"Extra direction\" is appended to it."
},
"inputs": [
{
@@ -55,7 +55,7 @@
{
"node": "4",
"field": "text",
- "template": "Give this person the face of the person in image 1: the eyes, nose, mouth, brows and face shape of image 1, matching the head angle, expression, lighting and skin tone around it. {details}"
+ "template": "Give this person exactly the face of the person in image 1: the same eyes, nose, mouth, brows and face shape as image 1. Keep this photo's own hairline and hair; match its head angle, expression, lighting and skin tone. {details}"
}
]
},
diff --git a/apps/face-swap/workflow.api.json b/apps/face-swap/workflow.api.json
index 7d2d948..13a81d6 100644
--- a/apps/face-swap/workflow.api.json
+++ b/apps/face-swap/workflow.api.json
@@ -221,11 +221,11 @@
"fm_mask",
0
],
- "expand": 16,
+ "expand": 0,
"tapered_corners": true
},
"_meta": {
- "title": "Grow the oval"
+ "title": "Grow or shrink the oval (px)"
}
},
"fm_encode": {
diff --git a/lab/cases.json b/lab/cases.json
index efa1e8c..4e39148 100644
--- a/lab/cases.json
+++ b/lab/cases.json
@@ -422,152 +422,152 @@
"note": "Face Swap with the face-oval mask, the pair the other way round (long wavy brown hair gets the short-bob woman's face). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
{"id": "tplx-face-swap-f", "app": "face-swap", "values": {"image": "@case:ref-face-a", "image2": "@case:ref-fx-woman-a"},
"overrides": [{"node": "fm_grow", "field": "expand", "value": -12}],
- "note": "Face Swap with the oval shrunk by 12 px instead of grown by 16: in run 20261024-032920-l40s the grown oval reached the hairline and Klein drew a high bare forehead."},
+ "note": "Face Swap with the oval shrunk by 12 px instead of grown by 16: in run 20261024-032920-l40s the grown oval reached the hairline and Klein drew a high bare forehead. Result in run 20261024-033622-l40s: works: no bare forehead, the face looks like the reference"},
{"id": "tplx-face-swap-g", "app": "face-swap", "values": {"image": "@case:ref-face-a", "image2": "@case:ref-fx-woman-a"},
"overrides": [{"node": "fm_grow", "field": "expand", "value": 0}, {"node": "4", "field": "text", "value": "Give this person exactly the face of the person in image 1: the same eyes, nose, mouth, brows and face shape as image 1. Keep this photo's own hairline and hair; match its head angle, expression, lighting and skin tone."}],
- "note": "Face Swap with the oval as found (no grow) and an instruction that keeps the photo's hairline and asks for exactly the other face."},
+ "note": "Face Swap with the oval as found (no grow) and an instruction that keeps the photo's hairline and asks for exactly the other face. Result in run 20261024-033622-l40s: works: the same as F, hairline kept. Became the template (mask as found, this instruction)."},
{"id": "tplx-face-swap-h", "app": "face-swap", "values": {"image": "@case:ref-fx-woman-a", "image2": "@case:ref-face-a"},
"overrides": [{"node": "fm_grow", "field": "expand", "value": 0}, {"node": "4", "field": "text", "value": "Give this person exactly the face of the person in image 1: the same eyes, nose, mouth, brows and face shape as image 1. Keep this photo's own hairline and hair; match its head angle, expression, lighting and skin tone."}],
- "note": "Same as G with the pair the other way round: does the head still turn?"},
+ "note": "Same as G with the pair the other way round: does the head still turn? Result in run 20261024-033622-l40s: works: the long-haired woman gets the short-bob woman's face, head angle kept"},
{"id": "ref-tpl-sketch", "app": "z-image", "values": {"prompt": "A rough pencil sketch on white paper of a cat sitting on a windowsill next to a potted plant, loose lines, no color", "width": 1024, "height": 1024},
- "note": "Reference sketch for Sketch to Real. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Reference sketch for Sketch to Real."},
{"id": "ref-tpl-sign", "app": "z-image", "values": {"prompt": "Photo of a small bakery storefront with a wooden sign above the door that reads OPEN in bold white letters, daylight, photorealistic", "width": 1280, "height": 768},
- "note": "Reference with legible text for Edit Text. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Reference with legible text for Edit Text."},
{"id": "ref-tpl-garment", "app": "z-image", "values": {"prompt": "Product photo of a mustard yellow knit cardigan laid flat on a plain white background, top-down, soft even light", "width": 1024, "height": 1024},
- "note": "A garment on its own, for the two-reference apps. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "A garment on its own, for the two-reference apps."},
{"id": "tpl-poster", "showcase": true, "app": "poster", "values": {"image": "@case:ref-product", "headline": "NOIR"},
- "note": "Poster. A poster layout with the bottle intact and the headline legible. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Poster. A poster layout with the bottle intact and the headline legible."},
{"id": "tpl-packshot", "showcase": true, "app": "packshot", "values": {"image": "@case:ref-product"},
- "note": "Packshot. Centered bottle, clean gradient, nothing else in frame. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Packshot. Centered bottle, clean gradient, nothing else in frame."},
{"id": "tpl-macro-scene", "showcase": true, "app": "macro-scene", "values": {"image": "@case:ref-product"},
- "note": "Macroshot Scene. Macro look with droplets; the label still readable. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Macroshot Scene. Macro look with droplets; the label still readable."},
{"id": "tpl-macro-product", "showcase": true, "app": "macro-product", "values": {"image": "@case:ref-product"},
- "note": "Macroshot Product. A tight detail of the bottle, not the whole bottle. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Macroshot Product. A tight detail of the bottle, not the whole bottle."},
{"id": "tpl-giant-product", "showcase": true, "app": "giant-product", "values": {"image": "@case:ref-product"},
- "note": "Giant Product. Convincing scale: the bottle towers over buildings. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Giant Product. Convincing scale: the bottle towers over buildings."},
{"id": "tpl-billboard", "showcase": true, "app": "billboard", "values": {"image": "@case:ref-face-a"},
- "note": "Billboard Ad. The portrait appears on the billboard, not as the whole image. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Billboard Ad. The portrait appears on the billboard, not as the whole image."},
{"id": "tpl-graffiti-ad", "showcase": true, "app": "graffiti-ad", "values": {"image": "@case:ref-fx-sneaker"},
- "note": "Graffiti Ad. A mural of the sneaker with graffiti texture. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Graffiti Ad. A mural of the sneaker with graffiti texture."},
{"id": "tpl-fridge-ad", "showcase": true, "app": "fridge-ad", "values": {"image": "@case:ref-product"},
- "note": "Fridge Ad. Fridge interior with the bottle on a shelf. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Fridge Ad. Fridge interior with the bottle on a shelf."},
{"id": "tpl-ugc-shot", "showcase": true, "app": "ugc-shot", "values": {"image": "@case:ref-product"},
- "note": "Marketing (UGC). A hand holding the bottle; snapshot look, label legible (tplx-ugc-shot-a, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Marketing (UGC). A hand holding the bottle; snapshot look, label legible (tplx-ugc-shot-a, 23 Oct)."},
{"id": "tpl-headshot", "showcase": true, "app": "headshot", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "AI Headshot Generator. Same face, studio light, blazer; shoulders-up. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "AI Headshot Generator. Same face, studio light, blazer; shoulders-up."},
{"id": "tpl-commercial-faces", "showcase": true, "app": "commercial-faces", "values": {"image": "@case:ref-fx-man-b"},
- "note": "Commercial Faces. Campaign look with his face unchanged and no invented text (tplx-commercial-faces-b, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Commercial Faces. Campaign look with his face unchanged and no invented text (tplx-commercial-faces-b, 23 Oct)."},
{"id": "tpl-style-snap", "showcase": true, "app": "style-snap", "values": {"image": "@case:ref-fx-woman-a", "style": "streetwear"},
- "note": "Style Snap. Full-length, new outfit, same face. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Style Snap. Full-length, new outfit, same face."},
{"id": "tpl-skin-enhancer", "showcase": true, "app": "skin-enhancer", "values": {"image": "@case:ref-fx-man-b"},
- "note": "Skin Enhancer. Subtle: compare with the input; pores still visible. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Skin Enhancer. Subtle: compare with the input; pores still visible."},
{"id": "tpl-outfit-vending", "showcase": true, "app": "outfit-vending", "values": {"image": "@case:ref-character"},
- "note": "Outfit Vending Machine. Red jacket, jeans and sneakers as vending items. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Outfit Vending Machine. Red jacket, jeans and sneakers as vending items."},
{"id": "tpl-glitter-sticker", "showcase": true, "app": "glitter-sticker", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "Glitter Sticker. Sticker look: white border, holographic sparkle. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Glitter Sticker. Sticker look: white border, holographic sparkle."},
{"id": "tpl-game-styles", "showcase": true, "app": "game-styles", "values": {"image": "@case:ref-fx-man-b", "style": "a cel-shaded action game"},
- "note": "Game Dump. Cel-shaded render with his features. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Game Dump. Cel-shaded render with his features."},
{"id": "tpl-plushie", "showcase": true, "app": "plushie", "values": {"image": "@case:ref-fx-duck"},
- "note": "Plushies. A plush duck with seams and embroidered eyes. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Plushies. A plush duck with seams and embroidered eyes."},
{"id": "tpl-render-3d", "showcase": true, "app": "render-3d", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "3D Render. 3D character look, recognizable hair and clothes (tplx-render-3d-a, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "3D Render. 3D character look, recognizable hair and clothes (tplx-render-3d-a, 23 Oct)."},
{"id": "tpl-figure-3d", "showcase": true, "app": "figure-3d", "values": {"image": "@case:ref-character"},
- "note": "3D Figure. Figure in packaging, same outfit. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "3D Figure. Figure in packaging, same outfit."},
{"id": "tpl-pixel-game", "showcase": true, "app": "pixel-game", "values": {"image": "@case:ref-fx-cafe"},
- "note": "Pixel Game. Visible pixels, HUD at the top. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Pixel Game. Visible pixels, HUD at the top."},
{"id": "tpl-brick-toy", "showcase": true, "app": "brick-toy", "values": {"image": "@case:ref-fx-toycar"},
- "note": "Brick Cube. A brick-built red car with studs. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Brick Cube. A brick-built red car with studs."},
{"id": "tpl-sketch-to-real", "showcase": true, "app": "sketch-to-real", "values": {"image": "@case:ref-tpl-sketch"},
- "note": "Sketch-to-Real. A real cat on a real windowsill, same layout as the sketch. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Sketch-to-Real. A real cat on a real windowsill, same layout as the sketch."},
{"id": "tpl-paint-app", "showcase": true, "app": "paint-app", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "Paint App. Crude flat drawing with a toolbar. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Paint App. Crude flat drawing with a toolbar."},
{"id": "tpl-mural", "showcase": true, "app": "mural", "values": {"image": "@case:ref-fx-man-b"},
- "note": "Signboard. Painted wall with his face, street below. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Signboard. Painted wall with his face, street below."},
{"id": "tpl-micro-beasts", "showcase": true, "app": "micro-beasts", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "Surrounded by Animals. Small animals on her shoulders; same face. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Surrounded by Animals. Small animals on her shoulders; same face."},
{"id": "tpl-meme", "showcase": true, "app": "meme", "values": {"scene": "a golden retriever sitting at a desk in front of three monitors, looking proud", "top": "WHEN THE TESTS", "bottom": "PASS FIRST TRY"},
- "note": "Meme Generator. Legible captions top and bottom. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Meme Generator. Legible captions top and bottom."},
{"id": "tpl-j-magazine", "showcase": true, "app": "j-magazine", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "J-Magazine. Magazine cover layout with her face. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "J-Magazine. Magazine cover layout with her face."},
{"id": "tpl-cafe-60s", "showcase": true, "app": "cafe-60s", "values": {"image": "@case:ref-fx-man-b"},
- "note": "60s Cafe. Period look, same face. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "60s Cafe. Period look, same face."},
{"id": "tpl-victory-card", "showcase": true, "app": "victory-card", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "Victory Card. Her face on the queen of hearts (tplx-victory-card-a, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Victory Card. Her face on the queen of hearts (tplx-victory-card-a, 23 Oct)."},
{"id": "tpl-j-poster", "showcase": true, "app": "j-poster", "values": {"image": "@case:ref-fx-man-b"},
- "note": "J-Poster. Bold graphic poster with his face. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "J-Poster. Bold graphic poster with his face."},
{"id": "tpl-mascot", "showcase": true, "app": "mascot", "values": {"image": "@case:ref-fx-man-b"},
- "note": "Mascot. Mascot suit, foam head under the arm, his face visible. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Mascot. Mascot suit, foam head under the arm, his face visible."},
{"id": "tpl-burning-sunset", "showcase": true, "app": "burning-sunset", "values": {"image": "@case:ref-fx-lake"},
- "note": "Burning Sunset. Same lake, fiery sky. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Burning Sunset. Same lake, fiery sky."},
{"id": "tpl-comic-book", "showcase": true, "app": "comic-book", "values": {"image": "@case:ref-fx-cafe"},
- "note": "Comic Book. Inked panel with halftone. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Comic Book. Inked panel with halftone."},
{"id": "tpl-giallo", "showcase": true, "app": "giallo", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "Giallo Horror. Gel lighting and grain; nothing gory. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Giallo Horror. Gel lighting and grain; nothing gory."},
{"id": "tpl-renaissance", "showcase": true, "app": "renaissance", "values": {"image": "@case:ref-fx-man-b"},
- "note": "Renaissance. Oil painting in a frame, same face. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Renaissance. Oil painting in a frame, same face."},
{"id": "tpl-japanese-show", "showcase": true, "app": "japanese-show", "values": {"image": "@case:ref-fx-woman-a"},
- "note": "Japanese Show. Four panels, TV captions. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Japanese Show. Four panels, TV captions."},
{"id": "tpl-breakdown", "showcase": true, "app": "breakdown", "values": {"image": "@case:ref-fx-sneaker"},
- "note": "Breakdown. Sole, laces, upper laid out on a grid. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Breakdown. Sole, laces, upper laid out on a grid."},
{"id": "tpl-edit-text", "showcase": true, "app": "edit-text", "values": {"image": "@case:ref-tpl-sign", "old": "OPEN", "new": "CLOSED"},
- "note": "Edit Text. The sign now reads CLOSED in the same style. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Edit Text. The sign now reads CLOSED in the same style."},
{"id": "tpl-image-effects", "showcase": true, "app": "image-effects", "values": {"image": "@case:ref-fx-cafe", "effect": "a heavy digital glitch effect: strong horizontal displacement bands, red and cyan RGB channel split, blocky pixel corruption, scan lines and data-mosh smears across the frame"},
- "note": "Image Effects. Strong RGB split and glitch bands over the cafe (tplx-image-effects-a, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Image Effects. Strong RGB split and glitch bands over the cafe (tplx-image-effects-a, 23 Oct)."},
{"id": "tpl-color-grade", "showcase": true, "app": "color-grade", "values": {"image": "@case:ref-fx-cafe", "look": "a strong teal and orange cinematic grade, shadows pushed to deep teal, skin tones and highlights warm orange, high contrast, slightly lifted blacks, fine film grain, like a blockbuster movie still"},
- "note": "Color Grading. Teal shadows, orange skin; nothing else changes (tplx-color-grade-a, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Color Grading. Teal shadows, orange skin; nothing else changes (tplx-color-grade-a, 23 Oct)."},
{"id": "tpl-fashion-factory", "showcase": true, "app": "fashion-factory", "values": {"image": "@case:ref-fx-woman-a", "image2": "@case:ref-tpl-garment"},
- "note": "Fashion Factory. She wears the yellow cardigan; catalog framing. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Fashion Factory. She wears the yellow cardigan; catalog framing."},
{"id": "tpl-try-on", "showcase": true, "app": "try-on", "values": {"image": "@case:ref-fx-man-b", "image2": "@case:ref-tpl-garment"},
- "note": "AI Stylist. Same photo of him, now in the cardigan. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "AI Stylist. Same photo of him, now in the cardigan."},
{"id": "tpl-outfit-swap", "showcase": true, "app": "outfit-swap", "values": {"image": "@case:ref-face-a", "image2": "@case:ref-character"},
- "note": "Outfit Swap. She wears his red jacket, jeans and sneakers. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Outfit Swap. She wears his red jacket, jeans and sneakers."},
{"id": "tpl-outfit-shot", "showcase": true, "app": "outfit-shot", "values": {"image": "@case:ref-fx-woman-b", "image2": "@case:ref-tpl-garment"},
- "note": "Outfit Shot. Studio shot in the cardigan, same face. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Outfit Shot. Studio shot in the cardigan, same face."},
{"id": "tpl-character-swap", "showcase": true, "app": "character-swap", "values": {"image": "@case:ref-fx-cafe", "image2": "@case:ref-fx-woman-a"},
- "note": "Character Swap. The woman sits in the cafe in the man's place and pose. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Character Swap. The woman sits in the cafe in the man's place and pose."},
{"id": "tpl-face-swap", "showcase": true, "app": "face-swap", "values": {"image": "@case:ref-face-a", "image2": "@case:ref-fx-woman-a"},
- "note": "Face Swap. Her portrait with the other woman's face; hair, jacket and background untouched. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Face Swap. Her portrait with the other woman's face; hair, jacket and background untouched (tplx-face-swap-g, 24 Oct)."},
{"id": "tpl-behind-the-scenes", "showcase": true, "app": "behind-the-scenes", "values": {"image": "@case:ref-face-a", "aspect": "16:9 (Widescreen)"},
- "note": "Behind the Scenes. A set appears around her as the camera widens. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Behind the Scenes. A set appears around her as the camera widens."},
{"id": "tpl-asmr-product", "showcase": true, "app": "asmr-product", "values": {"image": "@case:ref-product", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "ASMR Add-On. Hands tap the bottle; tapping sounds. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "ASMR Add-On. Hands tap the bottle; tapping sounds."},
{"id": "tpl-asmr-whisper", "showcase": true, "app": "asmr-whisper", "values": {"image": "@case:ref-fx-woman-a", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "ASMR Classic. Whispering and tapping; calm. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "ASMR Classic. Whispering and tapping; calm."},
{"id": "tpl-asmr-host", "showcase": true, "app": "asmr-host", "values": {"image": "@case:ref-fx-man-b", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "ASMR Host. Studio, mic, whisper. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "ASMR Host. Studio, mic, whisper."},
{"id": "tpl-chameleon", "showcase": true, "app": "chameleon", "values": {"image": "@case:ref-fx-sneaker", "aspect": "landscape", "duration": 4, "colors": "bright white with bold red patches"},
- "note": "Chameleon. A white and red chameleon on the sneaker; the sneaker unchanged (tplx-chameleon-m2, 24 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Chameleon. A white and red chameleon on the sneaker; the sneaker unchanged (tplx-chameleon-m2, 24 Oct)."},
{"id": "tpl-magic-button", "showcase": true, "app": "magic-button", "values": {"image": "@case:ref-product", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "Magic button. Button, sparks, the bottle floats. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Magic button. Button, sparks, the bottle floats."},
{"id": "tpl-truck-ad", "showcase": true, "app": "truck-ad", "values": {"image": "@case:ref-product", "aspect": "16:9 (Widescreen)", "enhance": false},
- "note": "Truck Ad. A toy truck with the bottle printed on it parks beside it (tplx-truck-ad-b, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Truck Ad. A toy truck with the bottle printed on it parks beside it (tplx-truck-ad-b, 23 Oct)."},
{"id": "tpl-kick-ad", "showcase": true, "app": "kick-ad", "values": {"image": "@case:ref-product", "aspect": "16:9 (Widescreen)", "enhance": false},
- "note": "Kick Ad. Grey boxes fly off; the bottle never moves. No real brands. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Kick Ad. Grey boxes fly off; the bottle never moves. No real brands."},
{"id": "tpl-volcano-ad", "showcase": true, "app": "volcano-ad", "values": {"image": "@case:ref-product", "aspect": "landscape", "duration": 4},
- "note": "Volcano Ad. The kitchen turns into a volcano behind the bottle; the label stays (first run on the morph base). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Volcano Ad. The kitchen turns into a volcano behind the bottle; the label stays (first run on the morph base)."},
{"id": "tpl-roller-coaster", "showcase": true, "app": "roller-coaster", "values": {"image": "@case:ref-fx-woman-a", "aspect": "portrait", "duration": 4},
- "note": "Roller Coaster. Front seat, hands up, same face (tplx-roller-coaster-m, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Roller Coaster. Front seat, hands up, same face (tplx-roller-coaster-m, 23 Oct)."},
{"id": "tpl-storm-creature", "showcase": true, "app": "storm-creature", "values": {"image": "@case:ref-fx-storm", "aspect": "16:9 (Widescreen)", "enhance": false},
- "note": "Storm Creature. A cloud giant with lightning in its chest behind the tree (tplx-storm-creature-b, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Storm Creature. A cloud giant with lightning in its chest behind the tree (tplx-storm-creature-b, 23 Oct)."},
{"id": "tpl-cloud-surf", "showcase": true, "app": "cloud-surf", "values": {"image": "@case:ref-fx-man-b", "aspect": "portrait", "duration": 4},
- "note": "Cloud Surf. Surfboard on pink clouds, same face (tplx-cloud-surf-m, 23 Oct). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Cloud Surf. Surfboard on pink clouds, same face (tplx-cloud-surf-m, 23 Oct)."},
{"id": "tpl-mukbang", "showcase": true, "app": "mukbang", "values": {"image": "@case:ref-fx-man-b", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "Mukbang. Food, mic, eating sounds. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Mukbang. Food, mic, eating sounds."},
{"id": "tpl-melting-doodle", "showcase": true, "app": "melting-doodle", "values": {"image": "@case:ref-fx-street", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "Melting Doodle. Doodles drawn, then dripping. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Melting Doodle. Doodles drawn, then dripping."},
{"id": "tpl-rap-video", "showcase": true, "app": "rap-video", "values": {"image": "@case:ref-fx-man-b", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "Rap God. Performance energy; a beat plays. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Rap God. Performance energy; a beat plays."},
{"id": "tpl-idol", "showcase": true, "app": "idol", "values": {"image": "@case:ref-fx-woman-a", "aspect": "9:16 (Portrait Widescreen)"},
- "note": "Idol. Stage, confetti, pose. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Idol. Stage, confetti, pose."},
{"id": "tpl-angles", "showcase": true, "app": "angles", "values": {"image": "@case:ref-fx-cafe"},
- "note": "Angles 2.0. The cafe seen from 45° to the left; same people and table. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Angles 2.0. The cafe seen from 45° to the left; same people and table."},
{"id": "tpl-shots", "showcase": true, "app": "shots", "values": {"image": "@case:ref-fx-lake", "shot": "将镜头转为特写镜头 Turn the camera to a close-up."},
- "note": "Shots. The hiker large in frame, seen from behind (the wide-angle showcase made him tiny). Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Shots. The hiker large in frame, seen from behind (the wide-angle showcase made him tiny)."},
{"id": "tpl-zooms", "showcase": true, "app": "zooms", "values": {"image": "@case:ref-fx-street"},
- "note": "Zooms. A close-up of the woman in the raincoat. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."},
+ "note": "Zooms. A close-up of the woman in the raincoat."},
{"id": "tpl-whats-next", "showcase": true, "app": "whats-next", "values": {"image": "@case:ref-fx-road"},
- "note": "What's Next?. The next shot of the road: wider, more landscape. Result in run 20261024-032920-l40s: works partly: the face changes and looks like the short-bob woman, but the head turns to the side; with the masked latent and only the face photo as reference the swap happens at last."}
+ "note": "What's Next?. The next shot of the road: wider, more landscape."}
]
}
diff --git a/tools/template_apps.py b/tools/template_apps.py
index 4926459..889d68e 100644
--- a/tools/template_apps.py
+++ b/tools/template_apps.py
@@ -380,9 +380,9 @@ A("character-swap", "Character Swap", "Character Swap", "identity", "edit2", "Sc
[], SCENE, {}, "The woman sits in the cafe in the man's place and pose.", image2_label="Photo of the new person", ref2=WOMAN)
A("face-swap", "Face Swap", "Face Swap", "identity", "edit2", "Photo to edit",
"Puts the face from a second photo onto the first; for faces you own or have permission to use.",
- "Give this person the face of the person in image 1: the eyes, nose, mouth, brows and face shape of image 1, matching the head angle, expression, "
- "lighting and skin tone around it.",
- [], PERSON, {}, "Her portrait with the other woman's face; hair, jacket and background untouched.", image2_label="Photo of the face", ref2=WOMAN,
+ "Give this person exactly the face of the person in image 1: the same eyes, nose, mouth, brows and face shape as image 1. Keep this photo's own "
+ "hairline and hair; match its head angle, expression, lighting and skin tone.",
+ [], PERSON, {}, "Her portrait with the other woman's face; hair, jacket and background untouched (tplx-face-swap-g, 24 Oct).", image2_label="Photo of the face", ref2=WOMAN,
help_="Only faces you own or have permission to use.", face_mask=True)
# ---------------------------------------------------------------- video templates (LTX-2.5 image-to-video, with sound)
@@ -583,7 +583,7 @@ def manifest(t: dict) -> dict:
notes += " plus a second LoadImage on ReferenceMultiLatent's images.image1"
if t["face_mask"]:
notes += ("; the sampler starts from the first image (scaled to 1 MP, encoded) with a noise mask on the face oval that the native "
- "MediaPipe nodes find, grown by 16 px, so only the face is redrawn, and the second image is Klein's only reference")
+ "MediaPipe nodes find, so only the face is redrawn, and the second image is Klein's only reference")
models = models + [FACE_MODEL]
credits = credits + ["MediaPipe Face Landmarker (Google, Apache-2.0), ComfyUI port: Comfy-Org/mediapipe"]
if t["base"] == "morph":
@@ -617,7 +617,8 @@ def workflow(t: dict) -> dict:
if t["base"] == "edit2": # a second reference image into the same ReferenceMultiLatent
api["12"] = {"class_type": "LoadImage", "inputs": {"image": "second.png"}, "_meta": {"title": "Second reference"}}
api["17"]["inputs"]["images.image1"] = ["12", 0]
- if t["face_mask"]: # start from the first image and let the sampler change only the face oval
+ if t["face_mask"]: # start from the first image and let the sampler change only the face oval (as found: grown 16 px it reached
+ # the hairline and Klein drew a high bare forehead, run 20261024-032920-l40s)
api["fm_scale"] = {"class_type": "ImageScaleToTotalPixels", "inputs": {"image": ["11", 0], "upscale_method": "lanczos", "megapixels": 1.0,
"resolution_steps": 16}, "_meta": {"title": "First image at 1 MP"}}
api["fm_model"] = {"class_type": "LoadMediaPipeFaceLandmarker", "inputs": {"model_name": FACE_MODEL["file"].split("/")[-1]},
@@ -626,7 +627,8 @@ def workflow(t: dict) -> dict:
"detector_variant": "both", "num_faces": 1, "min_confidence": 0.5,
"missing_frame_fallback": "empty"}, "_meta": {"title": "Find the face"}}
api["fm_mask"] = {"class_type": "MediaPipeFaceMask", "inputs": {"face_landmarks": ["fm_find", 0], "regions": "all"}, "_meta": {"title": "Face oval"}}
- api["fm_grow"] = {"class_type": "GrowMask", "inputs": {"mask": ["fm_mask", 0], "expand": 16, "tapered_corners": True}, "_meta": {"title": "Grow the oval"}}
+ api["fm_grow"] = {"class_type": "GrowMask", "inputs": {"mask": ["fm_mask", 0], "expand": 0, "tapered_corners": True},
+ "_meta": {"title": "Grow or shrink the oval (px)"}}
api["fm_encode"] = {"class_type": "VAEEncode", "inputs": {"pixels": ["fm_scale", 0], "vae": ["3", 0]}, "_meta": {"title": "Encode the first image"}}
api["fm_latent"] = {"class_type": "SetLatentNoiseMask", "inputs": {"samples": ["fm_encode", 0], "mask": ["fm_grow", 0]},
"_meta": {"title": "Only the face is redrawn"}}