diff --git a/apps/api/src/composition/planFrame.ts b/apps/api/src/composition/planFrame.ts index e710413..bab62ab 100644 --- a/apps/api/src/composition/planFrame.ts +++ b/apps/api/src/composition/planFrame.ts @@ -148,15 +148,53 @@ export function planFrame(input: { // The photograph's own aspect. A preset (4:5, 16:9, a portrait of a landscape frame) is not used. const aspect = null; const minWidth = minCropWidth(W, H, settings.minLongEdge); - const context = reportage ? "reportage" : "sport"; + const context: "sport" | "reportage" = reportage ? "reportage" : "sport"; const faces = input.faces ?? []; const focus = input.focus ?? null; const sport = input.sport ?? null; const lens = input.lens ?? null; const edgeClutter = input.edgeClutter; - const composition = detections ? compose(detections, aspect, { minWidth, focus, framing: settings.framing, context, faces, sport, lens, edgeClutter }) : null; - const wideComposition = detections && !reportage && settings.framing === "tight" ? compose(detections, aspect, { minWidth, focus, framing: "full", context: "sport", sport, edgeClutter }) : null; - const plans = reportage && detections ? { half: planCrop(detections, "half", aspect, { minWidth, focus, context, faces, edgeClutter }), threeQuarter: planCrop(detections, "threeQuarter", aspect, { minWidth, focus, context, faces, edgeClutter }) } : null; + const composition = detections + ? compose(detections, aspect, { + minWidth, + focus, + framing: settings.framing, + context, + faces, + sport, + lens, + ...(edgeClutter ? { edgeClutter } : {}), + }) + : null; + const wideComposition = + detections && !reportage && settings.framing === "tight" + ? compose(detections, aspect, { + minWidth, + focus, + framing: "full", + context: "sport", + sport, + ...(edgeClutter ? { edgeClutter } : {}), + }) + : null; + const plans = reportage && detections + ? { + half: planCrop(detections, "half", aspect, { + minWidth, + focus, + context, + faces, + ...(edgeClutter ? { edgeClutter } : {}), + }), + threeQuarter: planCrop(detections, "threeQuarter", aspect, { + minWidth, + focus, + context, + faces, + ...(edgeClutter ? { edgeClutter } : {}), + }), + } + : null; let crop: Box | null = null; let angle = input.angle; if (settings.crop && composition) {