Overview
This node integrates with the Automatic1111 API to generate images using Stable Diffusion models. Specifically, the Image to Image operation allows users to create new images based on an input image (provided as a Base64 string) and a text prompt that guides the transformation or generation process.
Common scenarios where this node is beneficial include:
- Enhancing or modifying existing images by applying artistic styles or transformations described in the text prompt.
- Creating variations of an input image while controlling aspects like style, detail, and composition.
- Automating creative workflows where images need to be generated or altered programmatically based on textual descriptions.
For example, you could provide a photo of a landscape and a prompt like "turn this into a watercolor painting" to generate a stylized version of the original image.
Properties
| Name | Meaning |
|---|---|
| Base64 Image | The source image encoded as a Base64 string to be used as the base for image generation. |
| Text Prompt | The descriptive text guiding how the image should be generated or transformed. |
| Options | A collection of additional parameters controlling the generation process: |
| - Batch Size | Number of images to generate in one batch (1 to 10). |
| - CFG Scale | Classifier-Free Guidance scale, controls adherence to the prompt (1 to 30, default 7). |
| - Image Height | Height of the output image in pixels (16 to 4096). |
| - Image Width | Width of the output image in pixels (64 to 4096). |
| - Negative Prompt | Text describing what should be avoided in the generated image. |
| - Seed | Random seed for reproducibility; -1 means random seed. |
| - Steps | Number of diffusion steps to perform (minimum 1), affecting quality and generation time. |
Output
The node outputs JSON data containing the generated images. Each generated image is typically returned as a Base64-encoded string within the JSON structure. This allows downstream nodes to use or save the generated images easily.
If multiple images are generated (batch size > 1), the output will contain an array of these Base64-encoded images.
No binary data output is explicitly handled by this node; all image data is managed as Base64 strings within JSON.
Dependencies
- Requires access to an instance of the Automatic1111 API (a Stable Diffusion web API).
- Needs an API URL and an API key credential configured in n8n to authenticate requests.
- The node sends HTTP POST requests to the API endpoints
/sdapi/v1/img2imgfor the Image to Image operation.
Troubleshooting
- Invalid Base64 Image: If the provided Base64 image string is malformed or empty, the API may reject the request. Ensure the image is correctly encoded.
- API Connection Errors: Network issues or incorrect API URL/credentials can cause failures. Verify the API endpoint and authentication details.
- Parameter Validation: Providing out-of-range values for options like width, height, batch size, or steps may result in errors. Use values within the specified limits.
- Seed Reproducibility: Using a seed of -1 generates random results each time; specify a positive integer seed for consistent outputs.
- Timeouts or Slow Responses: Large image sizes or high step counts increase processing time. Adjust parameters accordingly if performance is an issue.
Links and References
- Automatic1111 Stable Diffusion Web UI GitHub
- Stable Diffusion Documentation
- n8n Expressions Documentation (for dynamic parameter usage)