diff --git a/app/api/canvas/local-edit/route.ts b/app/api/canvas/local-edit/route.ts index 760f49063..131963d7d 100644 --- a/app/api/canvas/local-edit/route.ts +++ b/app/api/canvas/local-edit/route.ts @@ -2605,14 +2605,7 @@ async function buildScaleAdjustRmbgStructureLockedComposite(params: { }), }) : null; - const protectedPersonRemovalMask = - protectedPersonMask || - (protectedPersonSide && sameSizeCutout - ? buildScaleAdjustProtectedPersonGeometryMask({ - box: { width: cutoutWidth, height: cutoutHeight }, - side: protectedPersonSide, - }) - : null); + const protectedPersonRemovalMask = protectedPersonMask; const sideProtectedCleanedAlpha = protectedPersonSide && sameSizeCutout && sourceCropRaw ? suppressScaleAdjustProtectedFurnitureDarkAlpha({ @@ -2837,14 +2830,7 @@ async function buildScaleAdjustRmbgStructureLockedComposite(params: { .toBuffer(); const targetClipMaskPatch = await buildScaleAdjustOverlayClipMaskPatch(structureOverlay); - const productLockProtectMask = - protectedPersonRemovalMask || - (protectedPersonSide - ? buildScaleAdjustProtectedPersonGeometryMask({ - box: placement.sourceBox, - side: protectedPersonSide, - }) - : null); + const productLockProtectMask = protectedPersonMask; const productLockProtectMaskPatch = productLockProtectMask ? await buildScaleAdjustCompositeClipMaskPatch({ box: placement.sourceBox, @@ -2874,7 +2860,7 @@ async function buildScaleAdjustRmbgStructureLockedComposite(params: { placedWidth, protectedPersonSide, protectedPersonGeometryMaskApplied: - Boolean(protectedPersonRemovalMask) && !protectedPersonMask, + false, protectedPersonMaskApplied: Boolean(protectedPersonMask), sameSizeCutout, alphaBandingStats, @@ -4982,12 +4968,12 @@ function buildScaleAdjustProductLockBackgroundPrompt( "Return exactly one clean realistic full image with the same framing, camera, aspect ratio, and canvas extent as input image 1. Do not crop, zoom, pan, or resize the whole photo.", options.maskEdit ? options.draftInput - ? "Input image 1 is a full-photo repair draft from the original photo. The old selected furniture/product footprint has been roughly wiped and the locked product may already appear near its final target footprint. The supplied edit mask marks the rough/old footprint area that must be repaired into natural background and seamless integration; do not edit outside the masked area." + ? "Input image 1 is a full-photo rough background plate from the original photo. The old selected furniture/product footprint has been roughly wiped, and the target product is intentionally absent. The supplied edit mask marks only that rough old footprint area; repair it into natural background and do not edit outside the masked area." : "Input image 1 is the original clean full photo. The supplied edit mask marks the old selected furniture/product footprint that must be repaired as natural background; do not edit outside the masked area." : "Input image 1 is the original clean full photo. Input image 2 is a background plate reference that removes the selected furniture/product footprint and keeps the room/person/background layout stable.", "Important: do not draw, recreate, move, scale, duplicate, or redesign the selected furniture/product in the final image. The system will composite the locked original product pixels into the final target footprint after your background image is returned.", options.draftInput - ? "Your job is only to turn the rough wiped footprint and any visible draft haze, gray wash, ghost product silhouette, or edge patch into natural wall, curtain, floor, rug, shadow, sofa edge, and background. If the locked product is visible in the draft, keep the surrounding background and contact shadows natural, but do not invent a second product or preserve old-size remnants." + ? "Your job is only to turn the rough wiped footprint and any visible draft haze, gray wash, ghost product silhouette, or edge patch into natural wall, curtain, floor, rug, shadow, sofa edge, and background. Keep the target footprint empty and clean for the locked product layer; do not invent a product, second product, or old-size remnant." : "Your job is only to erase the old selected furniture/product footprint, complete newly exposed wall, curtain, floor, rug, shadow, sofa edge, and background naturally, and keep the target footprint clean enough for the locked product layer to sit there.", "Preserve all non-target people exactly as foreground/background context: do not move, cover, deform, redraw, change face, change body, change hands, change legs, change clothes, or change pose.", "Keep all non-target content stable: sofa, window, curtain, cabinet, lamp, wall art, floor, rug, lighting, textural grain, and global color must remain consistent.", @@ -5448,7 +5434,8 @@ export async function POST(request: NextRequest) { ? useScaleAdjustProductLockComposite ? useScaleAdjustProductLockMaskEdit ? [ - scaleAdjustPatchReference.targetDraftFullUrl || + scaleAdjustPatchReference.backgroundPlateFullUrl || + scaleAdjustPatchReference.targetDraftFullUrl || sourceImageUrl, ...scaleAdjustCropReferenceImageUrls, ...manualRegionReferenceImageUrls, @@ -5607,7 +5594,7 @@ export async function POST(request: NextRequest) { scaleAdjustPatchReferenceOrder: scaleAdjustPatchReference && useScaleAdjustFullFrameStructurePatch ? useScaleAdjustProductLockMaskEdit - ? "full-source-product-lock-edit-mask" + ? "product-lock-background-plate-edit-mask" : "full-source-full-target-draft" : scaleAdjustPatchReference && useScaleAdjustPatchTargetDraftPrimary ? includeScaleAdjustPatchSourceReference @@ -5699,7 +5686,7 @@ export async function POST(request: NextRequest) { ? scaleAdjustPatchReference ? useScaleAdjustProductLockComposite ? useScaleAdjustProductLockMaskEdit - ? "product-lock-mask-edit-rmbg-source-patch-one-shot" + ? "product-lock-background-plate-mask-edit-rmbg-one-shot" : "product-lock-background-plate-rmbg-v2-source-patch-one-shot" : useScaleAdjustFullFrameStructurePatch ? "full-frame-source-locked-target-guide-v8-one-shot"