Overview
This node integrates with an AI image generation service to perform various image-related actions such as generating images from prompts, describing images, upscaling images, creating variations, and zooming out images. It is useful for creative workflows where automated image generation or manipulation is needed, such as content creation, design prototyping, or enhancing visual assets.
Common scenarios include:
- Generating a grid of images based on a text prompt.
- Describing the content of an existing image.
- Upscaling a selected image to higher resolution.
- Creating variations of an existing image grid.
- Zooming out on an image to reveal more context.
- Executing custom commands using specific message identifiers.
Practical example:
- A user inputs a prompt "sunset over mountains" and uses the "Imagine" action to generate four AI-created images representing that scene.
- Another user provides an image URL and uses the "Describe" action to get textual descriptions of the image content.
- A designer can upscale a chosen image from a previous generation to improve its quality for print.
Properties
| Name | Meaning |
|---|---|
| Action | The operation to perform. Options: Custom, Describe, Imagine, Upscale, Variation, Zoom Out. |
| Prompt | Text prompt used to generate or vary images (required for Imagine and Variation actions). |
| MaxWait | Maximum wait time in seconds for the Imagine action to complete. |
| Image URI | URL of the image to describe (required for Describe action). |
| Message ID | Identifier of the message related to the image operation (required for Variation, Upscale, Zoom Out, Custom). |
| Message Hash | Hash value associated with the message (required for Variation, Upscale, Zoom Out). |
| Message Flags | Numeric flags related to the message state (required for Variation, Upscale, Zoom Out, Custom). |
| Index | Index number selecting which image to operate on (required for Variation and Upscale). |
| Custom ID | Custom identifier string for custom calls (required for Custom action). |
| Zoom Level | Zoom intensity level for the Zoom Out action. Options: High, Low, 2x, 1.5x. |
Output
The node outputs JSON data containing key information about the result of the performed action. Typical fields included in the output JSON are:
id: Unique identifier of the generated or processed image/message.hash: Hash string associated with the image or message.content: Textual content or prompt related to the image.uri: URI pointing to the generated or described image.flags: Numeric flags indicating status or properties of the image/message.options: Additional options or metadata returned by the service.
If the node handles binary data (e.g., image files), it would be represented separately, but this implementation focuses on JSON metadata referencing images via URIs.
Dependencies
- Requires an API credential with server ID, channel ID, and an authentication token for the AI image generation service.
- Uses the external
midjourneylibrary to interact with the AI service. - Requires network access to connect to the AI service endpoints.
- The node expects the credential to provide necessary connection details and tokens.
Troubleshooting
Common issues:
- Invalid or missing credentials will prevent connection to the AI service.
- Providing incorrect or incomplete parameters (e.g., missing required IDs or hashes) will cause errors.
- Network connectivity problems may cause timeouts or failures in image generation.
- Using banned words in prompts will silently remove them but may affect results.
Error messages:
"Could not imagine!"indicates failure to generate images from the prompt; check prompt validity and service availability.- Errors related to missing parameters will typically indicate which input is required.
- Connection errors suggest verifying API credentials and network settings.
Resolutions:
- Ensure all required parameters for the selected action are provided.
- Verify API credentials and their permissions.
- Avoid banned words in prompts.
- Check network connectivity and retry if transient errors occur.
- Use the node's "Continue On Fail" option to handle individual item errors gracefully.
Links and References
- Midjourney AI — Official site of the AI image generation service.
- n8n Documentation — For general guidance on creating and using custom nodes.
- Midjourney npm package — Library used internally by the node.