Separate Studio 2 source and canvas and apply size and seed choices

This commit is contained in:
Towsty
2026-09-11 07:07:26 -05:00
parent 09c96c0ae7
commit bf58732690
11 changed files with 163 additions and 41 deletions
+14
View File
@@ -34,3 +34,17 @@ export function attachHeroReference(g, image) {
}
return g
}
/** The shared image builders have their own defaults and megapixel scalers.
* Studio 2 must send its already resolved canvas size through those nodes. */
export function applyResolvedImageSize(graph, {width,height}) {
for (const node of Object.values(graph)) {
if (node.class_type === 'ImageScaleToTotalPixels') {
node.class_type='ImageScale'
node.inputs={image:node.inputs.image,upscale_method:'lanczos',width,height,crop:'disabled'}
} else {
if (typeof node.inputs?.width === 'number') node.inputs.width=width
if (typeof node.inputs?.height === 'number') node.inputs.height=height
}
}
return graph
}