fix: clarify fal scale adjust targets
This commit is contained in:
parent
e5ddc416e9
commit
6e5c608df8
@ -760,8 +760,21 @@ function buildScaleAdjustAnnotationSvg(params: {
|
||||
const { width, height, regions, scalePercent } = params;
|
||||
const minSide = Math.max(1, Math.min(width, height));
|
||||
const strokeWidth = Math.max(2, Math.round(minSide * 0.0034));
|
||||
const fontSize = Math.max(16, Math.round(minSide * 0.018));
|
||||
const labelPadX = Math.round(fontSize * 0.45);
|
||||
const labelPadY = Math.round(fontSize * 0.24);
|
||||
const targetColor = "#111827";
|
||||
const sourceColor = "#9ca3af";
|
||||
const label = (text: string, x: number, y: number, color: string) => {
|
||||
const labelWidth = Math.round(text.length * fontSize * 0.62 + labelPadX * 2);
|
||||
const labelHeight = Math.round(fontSize * 1.2 + labelPadY * 2);
|
||||
const left = clamp(x, 6, Math.max(6, width - labelWidth - 6));
|
||||
const top = clamp(y, 6, Math.max(6, height - labelHeight - 6));
|
||||
return `
|
||||
<rect x="${left}" y="${top}" width="${labelWidth}" height="${labelHeight}" rx="${Math.round(labelHeight * 0.24)}" fill="${color}" opacity="0.9" />
|
||||
<text x="${left + labelPadX}" y="${top + labelPadY + fontSize}" fill="#ffffff" font-size="${fontSize}" font-family="Arial, Helvetica, sans-serif" font-weight="800">${escapeXml(text)}</text>
|
||||
`;
|
||||
};
|
||||
|
||||
const regionSvg = regions
|
||||
.map((region) => {
|
||||
@ -774,6 +787,8 @@ function buildScaleAdjustAnnotationSvg(params: {
|
||||
return `
|
||||
<rect x="${source.left}" y="${source.top}" width="${source.width}" height="${source.height}" rx="${radius}" fill="none" stroke="${sourceColor}" stroke-width="${strokeWidth}" opacity="0.82" />
|
||||
<rect x="${target.left}" y="${target.top}" width="${target.width}" height="${target.height}" rx="${radius}" fill="none" stroke="${targetColor}" stroke-width="${Math.max(2, Math.round(strokeWidth * 1.08))}" opacity="0.88" />
|
||||
${label(`OLD ${region.index}`, source.left + strokeWidth, source.top + strokeWidth, sourceColor)}
|
||||
${label(`TARGET ${region.index}`, target.left + strokeWidth, target.top + strokeWidth, targetColor)}
|
||||
`;
|
||||
})
|
||||
.join("");
|
||||
@ -962,13 +977,15 @@ function buildFalScaleAdjustCoordinatePrompt(
|
||||
return [
|
||||
"Local furniture scale edit. Use input image 1 as the clean original photo and the locked camera frame.",
|
||||
`Return one seamless realistic photo with the same frame and pixel size as input image 1: ${sourceSize.width} x ${sourceSize.height} px.`,
|
||||
"Input image 2 is a separate neutral coordinate map, not a photo and not output content. The light gray OLD rectangle locates the current furniture in input image 1; the dark TARGET rectangle gives the final size and center.",
|
||||
"Input image 2 is a separate neutral coordinate map, not a photo and not output content. The light gray OLD rectangle/label locates the current furniture in input image 1; the dark TARGET rectangle/label gives the final size and center.",
|
||||
cropLines ? `${cropLines}` : "",
|
||||
"",
|
||||
"Task:",
|
||||
"Find the main movable furniture subject inside each OLD box in input image 1. Resize and, if needed, move that subject only so its final visible footprint matches the TARGET box.",
|
||||
"If an OLD box contains more than one object, choose the dominant furniture/product inside that box, usually the largest or most central movable item. Keep adjacent lamps, plants, side tables, pillows, wall decor, windows, text, and background objects at their original size unless they are clearly part of the same furniture subject.",
|
||||
"Keep the furniture identity, material, perspective, objects on top, and natural aspect ratio from input image 1. Do not create a second copy or extra parts.",
|
||||
"If the target is smaller, the furniture must visibly become smaller and the newly exposed floor, rug, wall, shadows, and background must be naturally healed. If the target is larger, enlarge the same furniture naturally without stretching it.",
|
||||
"Never keep the selected furniture at its original footprint. If the edited furniture still fills the OLD rectangle instead of the TARGET rectangle, the result is invalid.",
|
||||
"",
|
||||
"Region requirements:",
|
||||
regionLines,
|
||||
@ -984,6 +1001,7 @@ function buildFalScaleAdjustSystemPrompt() {
|
||||
"You are an image editing model for local furniture scale adjustment.",
|
||||
"Input image 1 is the only final photo base. Input image 2 is a coordinate instruction map, not a photo layer.",
|
||||
"Generate a clean realistic final photo by editing the target furniture itself and naturally rebuilding only the tiny surrounding background that becomes visible.",
|
||||
"Prefer a clear visible size change over a conservative unchanged result; unchanged furniture is a failed edit.",
|
||||
"Do not paste, composite, clone, crop, resize, or copy rectangular image patches from any input.",
|
||||
"Never output guide artifacts from the coordinate reference: no lines, labels, blocks, seams, rectangular borders, arrows, masks, UI marks, or annotations.",
|
||||
"Keep the camera frame, lighting, wall, floor, rug, windows, background furniture, text, logos, and all non-target regions stable.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user