Deploy this powerful n8n workflow template to automate AI image generation from chat prompts using Google Gemini for prompt engineering and external services for image creation. This n8n node flow is highly customizable.
Download this n8n workflow template and start using it instantly.
Marketing professionals needing quick, high-quality visual content creation.
Developers looking for robust n8n templates integrating Langchain and external AI APIs.
Automation specialists seeking advanced examples of prompt engineering within an n8n workflow.
Content creators who need a scalable, automated solution for generating custom images.
This sophisticated n8n workflow solves the challenge of turning simple, conversational text requests into detailed, high-quality images ready for deployment or storage. By leveraging Google Gemini for advanced prompt engineering, this automation ensures that the resulting image generation prompt adheres to best practices (like cinematic lighting, specific aspect ratios, and text integration), significantly boosting the quality of the final output from the external image API. This complete n8n template provides a plug-and-play solution, demonstrating how to handle user input via an n8n trigger, process complex data using code nodes, and interact with external services via the HTTP Request n8n node, making it an essential tool for any AI-driven operation.
This n8n workflow starts with a communication-based n8n trigger, typically a chat message.
When chat message received n8n trigger.Fields - Set Values n8n node sets the desired output parameters (defaulting to 1080x1920 resolution and the 'flux' model).AI Agent - Create Image From Prompt (a Langchain Agent powered by the Google Gemini Chat Model). This agent uses a highly detailed system prompt to transform the simple input into a structured, optimized JSON object containing the technical image prompt.Code - Clean Json n8n node meticulously parses the text output from the AI agent, which can often be messy, ensuring only clean, usable prompt text is extracted.Code - Get Prompt n8n node takes the cleaned prompts, iterates through them, and structures the final request payload, integrating the previously defined width/height parameters.Code - Set Filename n8n node generates sequential filenames (e.g., images_001.png) for the resulting image file.HTTP Request - Create Image n8n node uses the optimized prompt and configured settings to call the external image generation API (Pollinations.ai), fetching the resulting image data.Telegram Response n8n node or saved to local disk via the disabled Save Image To Disk n8n node. Users must activate their preferred output n8n node.To set up this powerful n8n workflow, follow these steps:
Google Gemini Chat Model (for the AI Agent), Telegram Response (if using Telegram output), and ensure your n8n instance has access to the directory defined in the Save Image To Disk n8n node (if using local storage).Fields - Set Values n8n node to adjust the default image width, height, or model (supported options include 'flux', 'kontext', 'turbo', 'gptimage').Telegram Response n8n node or the Save Image To Disk n8n node to define where the resulting image should be delivered. When chat message received (n8n trigger): This is the initial n8n trigger point. It captures user input from a chat interface, acting as the dynamic starting parameter for the entire n8n workflow.
Fields - Set Values (n8n node): Defines global variables for the workflow, specifically setting image size (1080x1920) and the image generation model ('flux').
AI Agent - Create Image From Prompt (Langchain n8n node): This core step orchestrates the prompt engineering. It uses Google Gemini and a structured system prompt template to convert simple user requests into highly technical, formatted AI prompts ready for generation.
Code - Clean Json (n8n node): Executes custom JavaScript to stabilize the output from the AI agent, specifically cleaning up surrounding text to reliably extract the essential JSON structure containing the image_prompt array.
Code - Get Prompt (n8n node): Custom code that formats the clean prompt into the exact JSON structure required by the external API call, merging user-defined settings with image generation parameters.
HTTP Request - Create Image (n8n node): The action node that executes the image generation. It sends the carefully crafted prompt to the Pollinations.ai API URL, fetching the binary image data in response. This n8n node handles the crucial API communication.
Automate real-time fraud detection for bookings using a powerful n8n workflow. It combines IP geolocation, Google Gemini AI analysis, and custom rule-based scoring to block critical transactions and flag high-risk activities. Use this n8n template to enhance security.

Use this powerful n8n workflow to monitor specific Gmail subjects (e.g., "Urgent," "Server Down") and instantly forward the essential details as a real-time notification using the Telegram n8n node.

Automate Reply.io outreach notifications (email and LinkedIn replies) to Telegram instantly. This efficient n8n workflow uses webhook triggers and Reply.io API calls for real-time sales alerts.

Automate YouTube video analysis. This powerful n8n workflow extracts transcripts, uses advanced AI models and a LangChain n8n node to generate structured summaries, and delivers the report via email. Use these n8n templates for swift content review.

Agent Circle - A growing marketplace of AI agents, workflows, and toolkits — built to help teams automate smarter and scale faster







































