Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Fix Extend conditioning and edge regeneration

Bitti17cdc7eb09a1
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index c127d21..391edbd 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -38,6 +38,7 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra
- The timeline playhead follows playback without waiting for editor updates.
- Character sheets give side and back views explicit orientation instructions, keeping reference identity and clothing without copying the front-facing pose.
- Extend bounding box edges gently snap to nearby original image borders when drawing, moving or resizing. Box dimensions use 32-pixel increments and stay within the maximum generation resolution.
+- Extend uses the original image as its reference instead of stretched edge padding, requests a wider scene, and fully regenerates the new area through the outer edges.
- Removing a reference from a scene's last prompt citation now removes it from generation inputs and “Used by.” References selected as frame or motion inputs remain active.
- Copy and paste effect settings between matching effects from their **…** menus, including bypass state and LUT data.
- Add voice reference chips directly in a shot's Speech field. Voice guidance stays separate from the words spoken.
diff --git a/src-tauri/core/src/slopfab/ffi/mod.rs b/src-tauri/core/src/slopfab/ffi/mod.rs
index 5c1e3da..51a9112 100644
--- a/src-tauri/core/src/slopfab/ffi/mod.rs
+++ b/src-tauri/core/src/slopfab/ffi/mod.rs
@@ -103,13 +103,13 @@ impl Api {
self.check(r)?;
self.inner.set_still_image(r.pointer.as_ptr())
}
- pub fn set_image_edit_path(&self, r: &RequestHandle, path: &Path, bounds: [i32; 4]) -> Result<(), String> {
+ pub fn set_image_edit_path(&self, r: &RequestHandle, path: &Path, bounds: [i32; 4], feather: i32) -> Result<(), String> {
self.check(r)?;
- self.inner.set_image_edit_path(r.pointer.as_ptr(), path, bounds)
+ self.inner.set_image_edit_path(r.pointer.as_ptr(), path, bounds, feather)
}
- pub fn set_image_edit_rgb(&self, r: &RequestHandle, pixels: &[u8], width: i32, height: i32, bounds: [i32; 4]) -> Result<(), String> {
+ pub fn set_image_edit_rgb(&self, r: &RequestHandle, pixels: &[u8], width: i32, height: i32, bounds: [i32; 4], feather: i32) -> Result<(), String> {
self.check(r)?;
- self.inner.set_image_edit_rgb(r.pointer.as_ptr(), pixels, width, height, bounds)
+ self.inner.set_image_edit_rgb(r.pointer.as_ptr(), pixels, width, height, bounds, feather)
}
pub fn set_save_latents(&self, r: &RequestHandle, path: &Path) -> Result<(), String> {
self.check(r)?;
diff --git a/src-tauri/core/src/slopfab/ffi/raw/mod.rs b/src-tauri/core/src/slopfab/ffi/raw/mod.rs
index 93eaf5f..da2e297 100644
--- a/src-tauri/core/src/slopfab/ffi/raw/mod.rs
+++ b/src-tauri/core/src/slopfab/ffi/raw/mod.rs
@@ -403,17 +403,17 @@ impl Api {
let set = self.set_still_image.ok_or("This slopfab.dll does not support still-image generation. Update the runtime to generate images and reference icons.")?;
self.error(unsafe { set(r, 1) })
}
- pub fn set_image_edit_path(&self, r: *mut Request, path: &Path, bounds: [i32; 4]) -> Result<(), String> {
+ pub fn set_image_edit_path(&self, r: *mut Request, path: &Path, bounds: [i32; 4], feather: i32) -> Result<(), String> {
let set = self.set_image_edit_path.ok_or("This slopfab.dll does not support bounding-box image editing. Update the runtime.")?;
let path = path_cstring(path)?;
- self.error(unsafe { set(r, path.as_ptr(), bounds[0], bounds[1], bounds[2], bounds[3], 1.0, 16) })
+ self.error(unsafe { set(r, path.as_ptr(), bounds[0], bounds[1], bounds[2], bounds[3], 1.0, feather) })
}
- pub fn set_image_edit_rgb(&self, r: *mut Request, pixels: &[u8], width: i32, height: i32, bounds: [i32; 4]) -> Result<(), String> {
+ pub fn set_image_edit_rgb(&self, r: *mut Request, pixels: &[u8], width: i32, height: i32, bounds: [i32; 4], feather: i32) -> Result<(), String> {
let set = self.set_image_edit_rgb.ok_or("This slopfab.dll does not support sequential image editing. Update the runtime.")?;
if width <= 0 || height <= 0 || pixels.len() != width as usize * height as usize * 3 {
return Err("Invalid image edit RGB buffer.".into());
}
- self.error(unsafe { set(r, pixels.as_ptr(), pixels.len(), width, height, width as usize * 3, bounds[0], bounds[1], bounds[2], bounds[3], 1.0, 16) })
+ self.error(unsafe { set(r, pixels.as_ptr(), pixels.len(), width, height, width as usize * 3, bounds[0], bounds[1], bounds[2], bounds[3], 1.0, feather) })
}
pub fn set_save_latents(&self, r: *mut Request, path: &Path) -> Result<(), String> {
let set = self.set_save_latents.ok_or(
diff --git a/src-tauri/core/src/slopfab/ffi/tests.rs b/src-tauri/core/src/slopfab/ffi/tests.rs
index ccda874..e28910b 100644
--- a/src-tauri/core/src/slopfab/ffi/tests.rs
+++ b/src-tauri/core/src/slopfab/ffi/tests.rs
@@ -5,17 +5,18 @@ fn image_edit_setters_use_original_pixel_boxes_and_pad_the_plan() {
let api = Api::load(&crate::slopfab::default_dll_path()).unwrap();
let request = RequestHandle::new(&api).unwrap();
let pixels = vec![100; 65 * 41 * 3];
- api.set_image_edit_rgb(&request, &pixels, 65, 41, [60, 35, 5, 6]).unwrap();
+ api.set_image_edit_rgb(&request, &pixels, 65, 41, [60, 35, 5, 6], 0).unwrap();
let plan = api.resolve(&request).unwrap();
assert_eq!((plan.canvas_width, plan.canvas_height, plan.aligned_frames), (96, 64, 1));
- assert!(api.set_image_edit_rgb(&request, &pixels, 65, 41, [60, 35, 6, 6]).is_err());
- assert!(api.set_image_edit_rgb(&request, &pixels[..3], 65, 41, [0, 0, 5, 6]).is_err());
+ assert!(api.set_image_edit_rgb(&request, &pixels, 65, 41, [60, 35, 6, 6], 0).is_err());
+ assert!(api.set_image_edit_rgb(&request, &pixels[..3], 65, 41, [0, 0, 5, 6], 0).is_err());
+ assert!(api.set_image_edit_rgb(&request, &pixels, 65, 41, [60, 35, 5, 6], -1).is_err());
assert_eq!(api.resolve(&request).unwrap().canvas_width, 96);
let folder = tempfile::tempdir().unwrap();
let path = folder.path().join("source.png");
image::RgbImage::from_raw(65, 41, pixels).unwrap().save(&path).unwrap();
let from_path = RequestHandle::new(&api).unwrap();
- api.set_image_edit_path(&from_path, &path, [0, 0, 65, 41]).unwrap();
+ api.set_image_edit_path(&from_path, &path, [0, 0, 65, 41], 16).unwrap();
std::fs::remove_file(path).unwrap(); // The setter snapshots pixels synchronously.
assert_eq!(api.resolve(&from_path).unwrap().aligned_frames, 1);
}
diff --git a/src-tauri/core/src/slopfab/h3.rs b/src-tauri/core/src/slopfab/h3.rs
index 0469bd3..9c56c64 100644
--- a/src-tauri/core/src/slopfab/h3.rs
+++ b/src-tauri/core/src/slopfab/h3.rs
@@ -62,10 +62,13 @@ pub(super) fn configure_request(
let step = edit.edits.first().ok_or("Add an image edit before generating.")?;
api.set_prompt(handle, &step.prompt)?;
let bounds = [step.x, step.y, step.width, step.height];
+ // Ordinary edits blend inward. Extend replaces padding all the way to
+ // the canvas edge; its finalizer restores the original intersection.
+ let feather = step.feather.unwrap_or(16);
if let Some(pixels) = &request.image_edit_pixels {
- api.set_image_edit_rgb(handle, pixels, request.canvas_width, request.canvas_height, bounds)?;
+ api.set_image_edit_rgb(handle, pixels, request.canvas_width, request.canvas_height, bounds, feather)?;
} else {
- api.set_image_edit_path(handle, request.image_edit_path.as_deref().ok_or("Image edit source has not been resolved.")?, bounds)?;
+ api.set_image_edit_path(handle, request.image_edit_path.as_deref().ok_or("Image edit source has not been resolved.")?, bounds, feather)?;
}
} else {
api.set_resolution(handle, request.canvas_width, request.canvas_height)?;
diff --git a/src-tauri/core/src/slopfab/planning.rs b/src-tauri/core/src/slopfab/planning.rs
index 4aed9e9..263ec8b 100644
--- a/src-tauri/core/src/slopfab/planning.rs
+++ b/src-tauri/core/src/slopfab/planning.rs
@@ -62,6 +62,7 @@ pub(super) fn validate_generation_controls(request: &GenerationRequest) -> Resul
if !request.still_image || request.frames != 1 || request.continuation_relative_path.is_some() || request.continuation_path.is_some() || request.video_transition.is_some()
|| edit.edits.is_empty() || edit.edits.len() > 500 || request.canvas_width > 8192 || request.canvas_height > 8192
|| edit.edits.iter().any(|step| step.prompt.trim().is_empty() || step.x < 0 || step.y < 0 || step.width <= 0 || step.height <= 0
+ || step.feather.is_some_and(|feather| !(0..=8192).contains(&feather))
|| i64::from(step.x) + i64::from(step.width) > i64::from(request.canvas_width)
|| i64::from(step.y) + i64::from(step.height) > i64::from(request.canvas_height)) {
return Err("Image edits require one source image and nonempty boxes inside its dimensions.".into());
diff --git a/src-tauri/core/src/slopfab/tests.rs b/src-tauri/core/src/slopfab/tests.rs
index 0f5e4ad..706058e 100644
--- a/src-tauri/core/src/slopfab/tests.rs
+++ b/src-tauri/core/src/slopfab/tests.rs
@@ -56,7 +56,7 @@ fn image_edit_recipe_disables_motion_cache_and_keeps_source_geometry() {
canvas_width: 65, canvas_height: 41,
image_edit_pixels: Some(std::sync::Arc::new(vec![100; 65 * 41 * 3])),
image_edit: Some(types::ImageEditRequest { source_relative_path: "media/source.png".into(), edits: vec![
- types::ImageEditStep { prompt: "A red vase".into(), x: 30, y: 10, width: 35, height: 31, reference_paths: None, refmods: None }
+ types::ImageEditStep { prompt: "A red vase".into(), x: 30, y: 10, width: 35, height: 31, feather: None, reference_paths: None, refmods: None }
] }), ..Default::default()
};
validate_generation_controls(&request).unwrap();
@@ -70,6 +70,19 @@ fn image_edit_recipe_disables_motion_cache_and_keeps_source_geometry() {
}
}
let mut invalid = request;
+ for feather in [None, Some(0), Some(16)] {
+ invalid.image_edit.as_mut().unwrap().edits[0].feather = feather;
+ // Explicit zero must survive transfer to a LAN worker; old requests
+ // without a feather value keep the ordinary editing default.
+ let roundtrip: GenerationRequest = serde_json::from_value(serde_json::to_value(&invalid).unwrap()).unwrap();
+ assert_eq!(roundtrip.image_edit.as_ref().unwrap().edits[0].feather, feather);
+ validate_generation_controls(&roundtrip).unwrap();
+ }
+ for feather in [-1, 8193] {
+ invalid.image_edit.as_mut().unwrap().edits[0].feather = Some(feather);
+ assert!(validate_generation_controls(&invalid).is_err());
+ }
+ invalid.image_edit.as_mut().unwrap().edits[0].feather = None;
invalid.image_edit.as_mut().unwrap().edits[0].width = 36;
assert!(validate_generation_controls(&invalid).is_err());
}
diff --git a/src-tauri/core/src/slopfab/types.rs b/src-tauri/core/src/slopfab/types.rs
index d5274da..1946cbc 100644
--- a/src-tauri/core/src/slopfab/types.rs
+++ b/src-tauri/core/src/slopfab/types.rs
@@ -96,6 +96,8 @@ pub struct ImageEditStep {
pub width: i32,
pub height: i32,
#[serde(default)]
+ pub feather: Option<i32>,
+ #[serde(default)]
pub reference_paths: Option<Vec<String>>,
#[serde(default)]
pub refmods: Option<Vec<RefmodInput>>,
diff --git a/src-tauri/src/commands/extend_image.rs b/src-tauri/src/commands/extend_image.rs
index 6fa216b..8cdcb61 100644
--- a/src-tauri/src/commands/extend_image.rs
+++ b/src-tauri/src/commands/extend_image.rs
@@ -132,11 +132,15 @@ fn write_png(path: &std::path::Path, image: &RgbaImage) -> Result<(), String> {
fn padded_source(source: &RgbaImage, bounds: ExtendBounds) -> RgbaImage {
RgbaImage::from_fn(bounds.width, bounds.height, |x, y| {
- // Edge replication gives inpainting color/texture context instead of black borders.
- *source.get_pixel(
- (x as i32 + bounds.x).clamp(0, source.width() as i32 - 1) as u32,
- (y as i32 + bounds.y).clamp(0, source.height() as i32 - 1) as u32,
- )
+ let sx = x as i32 + bounds.x;
+ let sy = y as i32 + bounds.y;
+ // Empty space must not contain replicated scene details for the model
+ // to copy. The inpainting mask regenerates this neutral padding.
+ if sx >= 0 && sy >= 0 && sx < source.width() as i32 && sy < source.height() as i32 {
+ *source.get_pixel(sx as u32, sy as u32)
+ } else {
+ image::Rgba([127, 127, 127, 255])
+ }
})
}
@@ -369,10 +373,18 @@ mod tests {
}
}
let padded = padded_source(&source, bounds);
- assert_eq!(
- padded.get_pixel(0, 0),
- source.get_pixel(bounds.x.clamp(0, 6) as u32, bounds.y.clamp(0, 4) as u32)
- );
+ for y in 0..bounds.height {
+ for x in 0..bounds.width {
+ let sx = x as i32 + bounds.x;
+ let sy = y as i32 + bounds.y;
+ let expected = if sx >= 0 && sy >= 0 && sx < 7 && sy < 5 {
+ source.get_pixel(sx as u32, sy as u32).0
+ } else {
+ [127, 127, 127, 255]
+ };
+ assert_eq!(padded.get_pixel(x, y).0, expected);
+ }
+ }
}
}
diff --git a/src/lib/extendImage.test.ts b/src/lib/extendImage.test.ts
index 704d00c..a099b3a 100644
--- a/src/lib/extendImage.test.ts
+++ b/src/lib/extendImage.test.ts
@@ -28,6 +28,18 @@ it("rejects boxes with no original context, no extension, fractional or excessiv
expect(large.x).toBeLessThan(0);
});
+it("regenerates every new pixel to the outer edge in all directions", () => {
+ const config = createProjectConfig({ name: "Extend", prompt: "", aspectRatio: "1:1", resolution: "416p", targetDurationSeconds: 15 });
+ const source = { id: "source", name: "Source", kind: "image" as const, mimeType: "image/png", width: 128, height: 96, createdAt: config.createdAt };
+ for (const x of [-64, 0, 32]) for (const y of [-32, 0, 32]) {
+ const { layout, edits } = compileExtendImage(config, source, "cache/canvas.png", { bounds: { x, y, width: 192, height: 128 }, prompt: "Forest", steps: 20, seed: 0 });
+ const contains = (r: { x: number; y: number; width: number; height: number }, px: number, py: number) => px >= r.x && py >= r.y && px < r.x + r.width && py < r.y + r.height;
+ for (let py = 0; py < layout.output.height; py++) for (let px = 0; px < layout.output.width; px++) {
+ if (!contains(layout.preserved, px, py)) expect(edits.some((edit) => edit.feather === 0 && contains(edit, px, py))).toBe(true);
+ }
+ }
+});
+
it("keeps selection and output on the generation grid without increasing the source pixel count", () => {
const config = createProjectConfig({ name: "Extend", prompt: "", aspectRatio: "16:9", resolution: "2048p", targetDurationSeconds: 15 });
for (const source of [{ width: 400, height: 300 }, { width: 3648, height: 2048 }, { width: 2048, height: 3648 }, { width: 8192, height: 8192 }]) {
diff --git a/src/lib/extendImage.ts b/src/lib/extendImage.ts
index 4dcfea3..cda99d3 100644
--- a/src/lib/extendImage.ts
+++ b/src/lib/extendImage.ts
@@ -90,15 +90,15 @@ export function compileExtendImage(config: ProjectConfig, source: ProjectAsset,
if (!Number.isSafeInteger(options.seed) || options.seed < -1) throw new Error("Seed must be -1 for random or a non-negative safe integer.");
const scene = createImageEditScene({ relativePath: sourceRelativePath, name: source.name, ...output });
scene.steps = options.steps; scene.seed = options.seed;
- scene.nodes[0].description = "Extend the scene naturally beyond its original framing. Continue the environment, objects, textures, perspective and lighting into the new space. Preserve the original scene and visual style. Replace the stretched edge placeholders with coherent new content. " + options.prompt.trim();
- const compiled = compileImagePrompt({ ...config, settings: { ...config.settings, defaultLook: null }, imageScene: scene });
+ scene.nodes[0].description = "Expand the field of view beyond the original image. Continue the environment, objects, textures, perspective and lighting into the new space with natural new detail. The original scene remains in its placed area within the larger composition. " + options.prompt.trim();
+ const compiled = compileImagePrompt({ ...config, settings: { ...config.settings, defaultLook: null }, imageScene: scene }, { sourceTreatment: "outpaint" });
// The rectangular editor needs a little original context at each seam.
// The native finalizer restores the downscaled source pixels after generation.
const overlap = 32;
const edits = regions.map((region) => {
const x = Math.max(0, region.x - overlap), y = Math.max(0, region.y - overlap);
return { x, y, width: Math.min(output.width, region.x + region.width + overlap) - x,
- height: Math.min(output.height, region.y + region.height + overlap) - y, prompt: compiled.prompt };
+ height: Math.min(output.height, region.y + region.height + overlap) - y, prompt: compiled.prompt, feather: 0 };
});
return { ...compiled, scene, edits, layout };
}
diff --git a/src/lib/extendWork.test.ts b/src/lib/extendWork.test.ts
index 6244872..7d377ee 100644
--- a/src/lib/extendWork.test.ts
+++ b/src/lib/extendWork.test.ts
@@ -55,8 +55,11 @@ it.each([false, true])("extends a frozen source and saves a child with a durable
const request = await submitted();
const { jobId } = request;
expect(request).toMatchObject({ stillImage: true, frames: 1, seed: 0, steps: 25, canvasWidth: 128, canvasHeight: 64,
- imageEdit: { sourceRelativePath: `cache/extend-images/${jobId}/canvas.png` }, referencePaths: [`C:/Extend/cache/extend-images/${jobId}/canvas.png`] });
+ imageEdit: { sourceRelativePath: `cache/extend-images/${jobId}/canvas.png` }, referencePaths: [`C:/Extend/cache/extend-images/${jobId}/original.png`] });
expect(request.imageEdit!.edits).toHaveLength(4);
+ expect(request.imageEdit!.edits.every((edit) => edit.feather === 0)).toBe(true);
+ expect(request.prompt).toContain("expands the scene in <Picture 1> beyond its original borders");
+ expect(request.prompt).not.toContain("composition anchor");
expect(request.prompt).toContain("Continue the forest");
expect(request.prompt).not.toContain("Changed");
expect(invoke).toHaveBeenCalledWith("prepare_extend_image", { folderPath: "C:/Extend", jobId, sourceId: "source", bounds: options().bounds, output: { width: 128, height: 64 } });
diff --git a/src/lib/imageEditing.ts b/src/lib/imageEditing.ts
index c726d9d..977df95 100644
--- a/src/lib/imageEditing.ts
+++ b/src/lib/imageEditing.ts
@@ -4,6 +4,7 @@ import type { ProjectConfig, ProjectReference } from "./project";
export interface ImageEditStep {
prompt: string; x: number; y: number; width: number; height: number;
+ feather?: number;
referencePaths?: string[];
refmods?: Array<{ path: string; strength: number; copies: number }>;
}
diff --git a/src/lib/imagePrompt.ts b/src/lib/imagePrompt.ts
index 60da0fe..0cfe68e 100644
--- a/src/lib/imagePrompt.ts
+++ b/src/lib/imagePrompt.ts
@@ -4,7 +4,7 @@ import { SHOT_TAG_GROUPS } from "./shot-tags";
/** Shared by generation and Debug Prompt. H3's base three-field / reference
* six-section contracts still apply to a single silent image. */
-export function compileImagePrompt(config: ProjectConfig, options: { referenceTransformations?: Readonly<Record<string, string>> } = {}) {
+export function compileImagePrompt(config: ProjectConfig, options: { referenceTransformations?: Readonly<Record<string, string>>; sourceTreatment?: "outpaint" } = {}) {
const scene = config.imageScene ?? createImageScene(config.brief.prompt);
// Only the references the prompt cites as @[ref:<id>] go to the generation.
const references = actionReferenceIds(imageScenePromptText(scene)).map((id) => {
@@ -16,6 +16,7 @@ export function compileImagePrompt(config: ProjectConfig, options: { referenceTr
// An inpainting source is also an explicit composition anchor. The caller
// submits it before the selected reference pictures, even with no subjects.
const editing = scene.rootType === "image" && Boolean(scene.sourceImage);
+ const outpainting = editing && options.sourceTreatment === "outpaint";
let picture = editing ? 1 : 0;
const subjects = references.flatMap((reference) => {
const labels = referenceImages(reference).map(() => `<Picture ${++picture}>`);
@@ -52,10 +53,16 @@ export function compileImagePrompt(config: ProjectConfig, options: { referenceTr
: `${label(index)} (appears in [Shot 1]): fully_preserved - retain the referenced ${subject.role} of ${subject.name} while following the requested composition and styling.`;
});
if (editing) {
- definitions.unshift("<Picture 1> is the original source image and composition anchor for the edited still keyframe in [Shot 1], providing the framing, perspective, environment, lighting and visual style.");
- retention.unshift("<Picture 1> ([Shot 1] edited keyframe): partially_preserved - retain its composition and visual characteristics except for the described change. Preserve all other content, including any previously completed edits.");
+ definitions.unshift(outpainting
+ ? "<Picture 1> shows the original scene before its field of view is expanded, providing the subject, environment, perspective, lighting and visual style. It does not show the complete output framing."
+ : "<Picture 1> is the original source image and composition anchor for the edited still keyframe in [Shot 1], providing the framing, perspective, environment, lighting and visual style.");
+ retention.unshift(outpainting
+ ? "<Picture 1> ([Shot 1] expanded scene): partially_preserved - preserve the existing scene within its placed area and generate a natural continuation beyond it. Expand the framing with new objects and scene detail consistent with the original perspective and lighting."
+ : "<Picture 1> ([Shot 1] edited keyframe): partially_preserved - retain its composition and visual characteristics except for the described change. Preserve all other content, including any previously completed edits.");
}
- const summary = editing
+ const summary = outpainting
+ ? "[reference generation] A single still image expands the scene in <Picture 1> beyond its original borders. The new space contains a coherent continuation of the scene."
+ : editing
? `[keyframe completion${subjects.length ? " + reference generation" : ""}] The target is a single edited still keyframe based on <Picture 1>. Apply the described change while preserving all other content.${subjects.length ? ` Use ${subjects.map((_, index) => label(index)).join(", ")} for the specified reference attributes.` : ""}`
: `[reference generation] A single still image uses ${subjects.map((_, index) => label(index)).join(", ")} in the requested composition.`;
const style = editing ? "The still image retains the visual medium, lighting, palette and perspective of <Picture 1>." : visual.style;
diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.ts
index 79fc888..dfc02a4 100644
--- a/src/lib/workQueue.ts
+++ b/src/lib/workQueue.ts
@@ -304,7 +304,8 @@ export class WorkQueue {
const id = `extend-${crypto.randomUUID()}`;
const sourceRelativePath = `cache/extend-images/${id}/canvas.png`;
const compiled = compileExtendImage(config, source, sourceRelativePath, options);
- const referencePaths = [projectItemPath(session.record.folderPath, { relativePath: sourceRelativePath })!,
+ // Reference only real scene content, never the ungenerated canvas padding.
+ const referencePaths = [projectItemPath(session.record.folderPath, { relativePath: `cache/extend-images/${id}/original.png` })!,
...compiled.references.flatMap((reference) => referenceImages(reference).map((image) => projectItemPath(session.record.folderPath, image)!))];
const request: SlopfabGenerationRequest = { jobId: id, stillImage: true, frames: 1, prompt: compiled.prompt,
canvasWidth: compiled.layout.output.width, canvasHeight: compiled.layout.output.height, steps: generationStepsWithLoras(options.steps, config), seed: imageGenerationSeed(options.seed),