/** * outpaint-keyframe — pad a keyframe to a target canvas and build an * inpainting mask for the new border region. * * Core (pad + mask) is pure/deterministic using only sharp. * Fill is optional/scaffold: if a fill() factory is provided it calls the * go-bananas REST edit endpoint; without a key it is inert. */ export interface OutpaintKeyframeInput { /** Absolute path to the source keyframe image. */ inputPath: string; /** Absolute path to write the output PNG. */ outputPath: string; /** Target canvas width in pixels (default 1920). */ targetWidth?: number; /** Target canvas height in pixels (default 1080). */ targetHeight?: number; /** * Dilation of the mask border into the original image region, expressed as * a fraction of the smaller canvas dimension (default 0.03). * E.g. on a 1920×1080 canvas, 0.03 × 1080 ≈ 32 px of feather overlap. */ maskDilation?: number; /** * Optional fill function. When provided it receives the padded PNG buffer * and the mask PNG buffer; its returned Buffer is written to outputPath * (filled:true). When absent the padded letterbox image is written * (filled:false). */ fill?: (req: { paddedPng: Buffer; maskPng: Buffer; env?: NodeJS.ProcessEnv; fetcher?: typeof fetch; }) => Promise; env?: NodeJS.ProcessEnv; fetcher?: typeof fetch; } export interface OutpaintKeyframeResult { outputPath: string; width: number; height: number; /** true when a fill() was provided and its output was written. */ filled: boolean; } /** * Pad `inputPath` onto a `targetWidth`×`targetHeight` canvas (centred, * letterboxed, transparent background) and produce an L-mode mask PNG where * the original image area is black (known region) and the padded border is * white (region to fill). An optional `fill()` factory can call an * inpainting backend and receive the filled result. */ export declare function outpaintKeyframe(input: OutpaintKeyframeInput): Promise; export declare const DEFAULT_GO_BANANAS_API_BASE = "https://gobananasai.com/api"; /** * Masked edits go through OpenAI gpt-image-2; go-bananas rejects mask_image_id * for any non-OpenAI model, so this is the only valid default. */ export declare const DEFAULT_OUTPAINT_MODEL_ID = "openai-gpt-image-2"; export declare const DEFAULT_OUTPAINT_PROMPT: string; export interface GoBananasOutpaintFillOptions { /** Outpaint instruction sent to the edit model (default DEFAULT_OUTPAINT_PROMPT). */ prompt?: string; /** * Edit model id. Must be an OpenAI model for masked edits (go-bananas refuses * mask_image_id otherwise). Default DEFAULT_OUTPAINT_MODEL_ID. */ modelId?: string; /** Optional explicit output size (e.g. '1536x1024'); omitted = provider default. */ size?: string; } interface GoBananasFillRequest { paddedPng: Buffer; maskPng: Buffer; env?: NodeJS.ProcessEnv; fetcher?: typeof fetch; } /** * Build a fill() function that performs a go-bananas masked outpaint via the * upload×2 → edit-by-id → download flow (verified against the live API): * * 1. POST {apiBase}/images/upload (padded source PNG) → image_id * 2. POST {apiBase}/images/upload (RGBA alpha mask PNG) → mask_image_id * 3. POST {apiBase}/edit-image { image_id, mask_image_id, model_id, prompt, size? } * → { fullUrl, ... } * 4. GET fullUrl → filled image bytes (returned as a Buffer) * * - apiBase from env GO_BANANAS_API_URL (default https://gobananasai.com/api) * - apiKey from env GO_BANANAS_API_KEY (throws env_var_missing when absent, * so the factory is inert in offline / CI contexts) * - injectable fetcher for offline testing */ export declare function goBananasOutpaintFill(options?: GoBananasOutpaintFillOptions): (req: GoBananasFillRequest) => Promise; export {}; //# sourceMappingURL=outpaint-keyframe.d.ts.map