图片生成图片
AI-generatedSummary
Generates or edits images based on a text prompt and reference image inputs using Gemini models.
Inputs
- model — The Gemini model used for generation (gemini-3.1-flash-image-preview, gemini-2.5-flash-image, or gemini-3-pro-image-preview).
- prompt (required) — Text prompt describing the desired image modifications or output.
- referenceImages — Reference images provided as URLs, Base64 data strings, or incoming binary field names, separated by vertical bars (|) or newlines. Up to 3 images for Flash, 14 for other models.
- aspectRatio — Target aspect ratio for the generated image (e.g., 1:1, 16:9, 9:16).
- resolution — Image resolution setting (512px, 1K, 2K, 4K) available for nano-banana-2 and Pro models.
- outputFormat — Format for output images: binary file attachment, image URL, Base64 data URL, or Base64 string.
- outputPropertyName — JSON property or binary field name used to store output data.
- throwOnFailure — When enabled, throws an n8n node error on failure; when disabled, returns a JSON object with success set to false and error details.
- showRawResponse — Includes the original raw API response in the output JSON.
- ignoreSslIssues — Skips SSL/TLS certificate verification when downloading reference images or making API calls.
- requestTimeout — Timeout in milliseconds for API calls and reference image fetches.
- maxRetries — Number of retries to attempt on rate limits or transient network errors.
- options.outputFileName — Filename pattern to use when saving binary file outputs.
Output shape
a single record
Returns a JSON object with success status and generation count. Output images are attached as n8n binary objects under outputPropertyName (indexed if multiple images are returned) or placed as strings in the JSON body depending on outputFormat.
Examples
Example 1: Transform an incoming binary image sketch into a realistic image
Set prompt to 'Convert this sketch into a photo-realistic landscape', set referenceImages to 'data' (referencing the input binary key), and outputFormat to 'binary'.
Example 2: Apply style transfer using an external image URL
Set prompt to 'Apply cyber-punk lighting and color scheme', referenceImages to 'https://example.com/style.jpg', model to 'gemini-3.1-flash-image-preview', and outputFormat to 'dataUrl'.