UNPKG

@builder.io/dev-tools

Version:

Builder.io Visual CMS Devtools

57 lines (56 loc) 1.81 kB
import type { ContentMessageItemImage } from "$/ai-utils"; import type { DevToolsSys } from "../../types"; export interface GifGeneratorOptions { duration?: string; outputPath: string; cleanup?: boolean; sys?: DevToolsSys; maxWidth?: number; debug?: boolean; } export declare class GifGenerator { #private; private frames; private tmpDir; private static ffmpegAvailable; /** * Check if ffmpeg is available on the system */ static checkFfmpegAvailable(): Promise<boolean>; /** * Add an image frame to the GIF * @param image ContentMessageItemImage with base64 source */ addImage(image: ContentMessageItemImage): void; /** * Add multiple image frames to the GIF * @param images Array of ContentMessageItemImage with base64 sources */ addImages(images: ContentMessageItemImage[]): void; /** * Get the number of frames added */ getFrameCount(): number; /** * Clear all frames */ clearFrames(): void; /** * Generate the GIF from the added frames * @param options Generation options * @returns Path to the generated GIF file */ generateGif(options: GifGeneratorOptions): Promise<string>; /** * Manually cleanup if needed (useful for non-cleanup mode) */ cleanup(): Promise<void>; } /** * Helper function to quickly generate a GIF from images * This function is completely safe and will never throw exceptions * @param images Array of ContentMessageItemImage with base64 sources * @param options Generation options * @returns Path to the generated GIF file, or null if generation failed */ export declare function generateGifFromImages(images: ContentMessageItemImage[], options: GifGeneratorOptions): Promise<string | null>;