You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
665 B
24 lines
665 B
export const OUTPAINTING_DEFAULT_PROMPT = "将画面自然延展,补充完整场景";
|
|
|
|
interface MediaDimensions {
|
|
width: number;
|
|
height: number;
|
|
}
|
|
|
|
interface OutpaintingInsets {
|
|
top: number;
|
|
left: number;
|
|
right: number;
|
|
bottom: number;
|
|
}
|
|
|
|
export function deriveOutpaintingOutputDimensions(
|
|
sourceDimensions: MediaDimensions | null | undefined,
|
|
params: OutpaintingInsets
|
|
): MediaDimensions | null {
|
|
if (!sourceDimensions) return null;
|
|
return {
|
|
width: Math.max(1, Math.round(sourceDimensions.width * (1 + params.left + params.right))),
|
|
height: Math.max(1, Math.round(sourceDimensions.height * (1 + params.top + params.bottom))),
|
|
};
|
|
}
|
|
|