🖼️

Automating Image Generation with n8n

Jun 4, 2025

Generate Images from Text Prompts with Google Imagen 3 via Replicate API | n8n Workflow Template

Overview

  • This workflow utilizes the n8n platform to automate image generation using Google Imagen 3 via the Replicate API.

Target Audience

  • Developers, digital artists, and content creators looking to generate AI-driven images.

Problem Statement

  • The workflow automates the image generation process from textual prompts, enabling users to efficiently generate, check status, and retrieve images with minimal manual effort.

Workflow Steps

  1. Initialize Workflow
    • Triggered by a manual action for image generation.
  2. Set Image Generation Parameters
    • Users define prompts and parameters to send to the Replicate API.
  3. Create Prediction
    • Sends a request to generate an image based on user input.
  4. Check Prediction Status
    • Checks the status after a brief wait.
  5. Handle Errors
    • Stops the workflow and reports errors if status indicates failure.
  6. Retrieve Image URL
    • Outputs the URL of the generated image upon success.

Setup Instructions

  1. Replicate API Key
    • Sign up for an account on the Replicate website.
    • Generate an API key from your dashboard.
  2. Configure HTTP Credentials in n8n
    • Navigate to the "Credentials" section.
    • Create a new HTTP Header Authentication credential:
      • Name: Authorization
      • Value: Bearer YOUR_REPLICATE_API_KEY (replace with your actual key).

Customization Options

  • Edit Prompt Text: Change the prompt in the "Set prompt" node for customized image generation.
  • Change Image Generation Settings: Adjust parameters such as aspect ratio, safety filter, or model in the "Create prediction" node.
  • Add More Logic: Modify "Check for success" and "Check for errors" nodes for complex conditions or branching logic.
  • Modify Wait Duration: Optimize waiting time in the "Wait" and "Pause" nodes based on expected generation speed.

Conclusion

  • n8n allows for comprehensive automation solutions for image generation, enabling users to integrate with various APIs effortlessly.