Add extension-frame refine and lossless anchor options.

Prefer clip anchor PNGs for handoffs, optionally run Bilateral+Flux cleanup before I2V, and save decoded last-frame anchors so sequential extensions accumulate less compression damage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-04 07:55:46 -05:00
co-authored by Cursor
parent 5917d5bb37
commit f41ac7a826
14 changed files with 674 additions and 14 deletions
+28
View File
@@ -275,6 +275,34 @@ export function watchComfyJob(job: Job, options: { persist?: boolean } = {}): Pr
loraStack: job.library.loraStack,
segmentFirstFrame
})
if (job.library.saveLosslessAnchor === true) {
try {
const { persistClipAnchorFrame, extractAnchorImageFromHistory, downloadAnchorImage } = await import('~/server/utils/extensionFrame')
let saved = false
if (job.promptId && history) {
const anchorImage = extractAnchorImageFromHistory(history, job.promptId)
if (anchorImage) {
const png = await downloadAnchorImage(anchorImage)
if (png.length >= 64) {
await persistClipAnchorFrame({
ownerKey: job.library.ownerKey,
clipId: clip.id,
fromBuffer: png
})
saved = true
}
}
}
if (!saved) {
await persistClipAnchorFrame({
ownerKey: job.library.ownerKey,
clipId: clip.id
})
}
} catch {
/* Anchor is optional; extension can still extract from MP4. */
}
}
job.clipId = clip.id
job.savedPromptId = job.promptId
job.hideThumbnail = clip.hideThumbnail