Simple AI Image Generation Via Web Form - n8n Workflow

Deploy this powerful n8n workflow to generate images using the OpenAI GPT-Image-1 model via a simple web form interface. Learn how this n8n automation handles API calls, file conversion, and user interaction.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Marketing teams needing a quick, non-technical way to generate AI art.
Developers looking for high-quality n8n templates for OpenAI integrations.
Users who need to expose a powerful API like DALL-E/GPT-Image-1 via a simple, internal web form.
Anyone utilizing n8n to centralize access to expensive AI services.

Overview

Leveraging advanced AI capabilities often requires interacting directly with complex APIs. This specific n8n workflow solves this by creating an incredibly user-friendly front-end interface using the n8n Form Trigger. Instead of writing code or accessing API documentation, users simply fill out a prompt and select their desired image size (1024x1024, 1024x1536, or 1536x1024).

The automation seamlessly passes these inputs to the OpenAI service using the powerful gpt-image-1 model. The resulting image data is processed, converted, and returned directly to the initiating form, making this one of the most practical n8n templates for creative asset generation. This n8n automation eliminates friction, making advanced AI imaging accessible to anyone with the link to the n8n trigger.

How it Works

This powerful n8n workflow operates in four main stages:


  1. Initiation via n8n Trigger: The workflow starts with the 'Prompt and options' n8n trigger, which presents a custom web form to the user. The user inputs the desired text prompt and selects the required image dimensions.

  2. API Execution: Once the form is submitted, the data is passed to the 'OpenAI Image Generation' n8n node (an HTTP Request node). This node uses the provided prompt and size to call the OpenAI v1/images/generations endpoint, specifically targeting the gpt-image-1 model.

  3. Data Conversion: OpenAI returns the generated image as a Base64 encoded JSON string. The next critical step is the 'Convert to File' n8n node, which takes the b64_json output and transforms it into a standard binary file that n8n can recognize as a downloadable image.

  4. Result Delivery: Finally, the 'Return to form' n8n node utilizes the binary data and the 'completion' operation to display the generated image immediately back on the user's web browser, completing the entire process initiated by the n8n trigger.

Installation Guide

To use this n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON code and import it into your n8n instance using the 'New' menu and selecting 'Import from JSON'.

  2. Set Up OpenAI Credentials: The 'OpenAI Image Generation' n8n node requires an existing OpenAI API credential.

Go to Credentials in n8n.
Add a new credential of type OpenAI API.
Input your API Key (usually starting with sk-).
Ensure the HTTP Request node is linked to this new credential.

  1. Activate the n8n Trigger: Since this uses a Form Trigger, the workflow must be activated (toggled to 'Active') for the web form URL to become accessible.

  2. Test: Access the URL generated by the 'Prompt and options' n8n node to test the image generation process.

Node Details

Prompt and options (Form Trigger n8n node): This is the entry point and n8n trigger for the automation. It creates a simple web interface allowing users to input the 'Prompt' text and select the 'Image size' from predefined options (1024x1024, 1024x1536, 1536x1024).
OpenAI Image Generation (HTTP Request n8n node): This core processing n8n node handles the communication with OpenAI. It is configured to use the gpt-image-1 model and dynamically injects the prompt and size parameters received from the form trigger.
Convert to File (Convert to File n8n node): Essential for handling API output. It specifically converts the Base64 JSON output (data[0].b64_json) from the OpenAI response into a binary file format, which is necessary for displaying the image correctly.
Return to form (Form n8n node): Configured for 'completion' and set to 'returnBinary'. This n8n node ensures that the final image file is rendered and returned to the user who initially filled out the form, providing a seamless feedback loop.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all

Featured*