UNPKG

@imgly/plugin-ai-image-generation-web

Version:

AI image generation plugin for the CE.SDK editor

46 lines (45 loc) 1.62 kB
import type CreativeEditorSDK from '@cesdk/cesdk-js'; /** * Converts a blob: or buffer: URL to a data URI that Runware can accept */ export declare function convertImageUrlForRunware(imageUrl?: string, cesdk?: CreativeEditorSDK): Promise<string | undefined>; export declare function isCustomImageSize(imageSize: any): imageSize is { width: number; height: number; }; /** * Constraints for a single dimension (width or height) */ export interface DimensionRange { min: number; max: number; } /** * Model-specific dimension constraints for image generation. * Allows separate constraints for width and height. */ export interface DimensionConstraints { width: DimensionRange; height: DimensionRange; /** Round dimensions to this multiple (e.g., 16). Defaults to 1 if not specified. */ multiple?: number; } /** * Converts an array of blob:/buffer: URLs to data URIs for Runware. * Used for multi-image inputs like combineImages quick action. */ export declare function convertImageUrlArrayForRunware(imageUrls?: string[], cesdk?: CreativeEditorSDK): Promise<string[] | undefined>; /** * Adjusts dimensions to meet API constraints: * - Width and height are constrained to their respective min/max ranges * - Optionally rounds to a multiple (e.g., 16) * - Preserves aspect ratio when scaling * * @param width - Original width * @param height - Original height * @param constraints - Model-specific dimension constraints */ export declare function adjustDimensions(width: number, height: number, constraints: DimensionConstraints): { width: number; height: number; };