图生图
AI-generatedSummary
Generate images from text prompts or existing images using the LiblibAI service.
Inputs
- prompt (required) — The textual prompt for image generation (max 2000 characters).
- imgCount — The number of images to generate (1 to 4).
- sizeMode — Choose between using a preset aspect ratio or custom dimensions.
- aspectRatio — The aspect ratio if using a preset (square, portrait, landscape).
- imageWidth — Custom width for the generated image (512 to 2048 pixels) when sizeMode is set to custom.
- imageHeight — Custom height for the generated image (512 to 2048 pixels) when sizeMode is set to custom.
- sourceImage (required) — URL of the source image for image-to-image generation.
- waitForCompletion — Whether to wait for the task to complete before returning results.
- maxWaitTime — Maximum wait time for task completion before timing out.
- pollInterval — Interval for checking the task status (in seconds).
Output shape
a list of generated images
Returns the generated images along with their statuses, if waitForCompletion is enabled.
Examples
Example 1: Generate a fantasy landscape image from a text prompt
Set prompt to 'A beautiful fantasy landscape', imgCount to 1, sizeMode to aspectRatio with default settings.
Example 2: Transform an existing image using an uploaded source image.
Set prompt to 'Transform this image', imgCount to 1, sizeMode to custom, provide a sourceImage URL.
