diff --git a/app/api/canvas/local-edit/route.ts b/app/api/canvas/local-edit/route.ts index ba0919323..e238c1341 100644 --- a/app/api/canvas/local-edit/route.ts +++ b/app/api/canvas/local-edit/route.ts @@ -3984,6 +3984,15 @@ async function createScaleAdjustPatchReference(params: { return uploadScaleAdjustPrepAsset(filename, buffer); }; if (params.fullFrameReferenceOnly && structureLockAppliedRef.value) { + const sourceFullUploadBuffer = await sharp(sourceBuffer, { failOn: "none" }) + .rotate() + .flatten({ background: "#ffffff" }) + .jpeg({ quality: 94, mozjpeg: true }) + .toBuffer(); + const sourceFullUpload = await uploadScaleAdjustPrepAsset( + `canvas-scale-adjust-full-source-${suffix}.jpg`, + sourceFullUploadBuffer + ); const targetDraftFullUpload = await uploadScaleAdjustPrepAsset( `canvas-scale-adjust-full-target-draft-${suffix}.jpg`, targetDraftUploadBuffer @@ -4042,7 +4051,7 @@ async function createScaleAdjustPatchReference(params: { productLockFalEditMaskUrl: productLockFalEditMaskUpload?.url || null, productLockOverlayUrl: productLockOverlayUpload?.url || null, productLockProtectMaskUrl: productLockProtectMaskUpload?.url || null, - sourceCropUrl: sourceImageUrl || fullFrameFallbackUrl, + sourceCropUrl: sourceFullUpload?.url || sourceImageUrl || fullFrameFallbackUrl, structureLockedDraft: structureLockAppliedRef.value, targetDraftFullUrl: fullFrameFallbackUrl, targetDraftUrl: fullFrameFallbackUrl, @@ -5695,12 +5704,12 @@ export async function POST(request: NextRequest) { ? useScaleAdjustProductLockComposite ? useScaleAdjustProductLockMaskEdit ? [ - sourceImageUrl, + scaleAdjustPatchReference.sourceCropUrl, ...scaleAdjustCropReferenceImageUrls, ...manualRegionReferenceImageUrls, ] : [ - sourceImageUrl, + scaleAdjustPatchReference.sourceCropUrl, scaleAdjustPatchReference.backgroundPlateFullUrl as string, ...scaleAdjustCropReferenceImageUrls, ...manualRegionReferenceImageUrls,