[Agent Circle的N8N工作流] 自动化AI图像生成器
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 Set, Code, Telegram, HttpRequest, ReadWriteFile 等节点。 免费AI图像生成器 - 基于Gemini/ChatGPT的n8n自动化工作流
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
使用的节点 (16)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "cmncRJ2rlecEwZxU",
"meta": {
"instanceId": "ed6d846a2fce1f660ede2e7da800724cca01dc3d0685524a3c917881b7cfcfe9"
},
"name": "[Agent Circle的N8N工作流] 自动化AI图像生成器",
"tags": [],
"nodes": [
{
"id": "d5d1fe1b-f053-4162-adf4-5b52b409942d",
"name": "字段 - 设置值",
"type": "n8n-nodes-base.set",
"position": [
240,
100
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4e04fec4-441e-45f7-acea-0017a4b5c104",
"name": "model",
"type": "string",
"value": "flux"
},
{
"id": "aa80cd68-1c82-4032-b1d7-e098856eec38",
"name": "width",
"type": "string",
"value": "1080"
},
{
"id": "da6d305f-aece-49bd-ae02-52df59915c60",
"name": "height",
"type": "string",
"value": "1920"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e108c56f-b7fb-4818-aed5-c55c59b81516",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
20,
200
],
"webhookId": "5b347b5d-8f35-45b3-a499-de95153088f0",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "7565ff7c-cfe7-4157-953b-74c1e66d659e",
"name": "代码 - 清理 JSON",
"type": "n8n-nodes-base.code",
"position": [
980,
100
],
"parameters": {
"jsCode": "function cleanAndExtractJSON(response) {\n try {\n const result = {\n image_prompt: []\n };\n\n const lines = response.split('\\n');\n let currentPrompt = '';\n\n for (const line of lines) {\n if (line.includes('\"prompt\":')) {\n if (currentPrompt) {\n result.image_prompt.push(currentPrompt.trim());\n }\n currentPrompt = line.split('\"prompt\":')[1].trim();\n }\n }\n\n if (currentPrompt) {\n result.image_prompt.push(currentPrompt.trim());\n }\n\n return { json: result };\n \n } catch (error) {\n return { \n json: {\n image_prompt: []\n }\n };\n }\n}\n\nconst response = $input.first().json.output;\nreturn cleanAndExtractJSON(response);"
},
"executeOnce": false,
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "8e33813d-bd34-46b9-91c8-89dac7f28add",
"name": "代码 - 获取提示",
"type": "n8n-nodes-base.code",
"position": [
1160,
100
],
"parameters": {
"jsCode": "return $input.first().json.image_prompt.map(prompt => ({\n json: {\n body: {\n prompt: prompt,\n \"image_size\": {\n \"width\": $('Fields - Set Values').first().json.width,\n \"height\": $('Fields - Set Values').first().json.height\n },\n \"num_inference_steps\": 12,\n \"guidance_scale\": 3.5,\n \"num_images\": 1,\n \"enable_safety_checker\": true,\n}\n }\n }\n));"
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "fba88baa-70e8-452c-b44e-d1685df0eb7d",
"name": "HTTP请求 - 创建图像",
"type": "n8n-nodes-base.httpRequest",
"position": [
1600,
100
],
"parameters": {
"url": "=https://image.pollinations.ai/prompt/ {{ $('Code - Get Prompt').item.json.body.prompt }}",
"options": {},
"jsonQuery": "={\n \"width\": {{ $('Fields - Set Values').item.json.width }},\n \"height\": {{ $('Fields - Set Values').item.json.height }},\n \"model\": \"{{ $('Fields - Set Values').item.json.model }}\",\n \"seed\": 42,\n \"nologo\": true\n}",
"sendQuery": true,
"sendHeaders": true,
"specifyQuery": "json",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.2,
"alwaysOutputData": true,
"waitBetweenTries": 5000
},
{
"id": "25617f21-8d05-4ca2-9c16-5cd97e369bdb",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"disabled": true,
"position": [
20,
0
],
"webhookId": "ff17baeb-3182-41c4-b60a-e6159b02023b",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "de666684-e743-40ef-b604-1cff33b107de",
"name": "代码 - 设置文件名",
"type": "n8n-nodes-base.code",
"position": [
1320,
100
],
"parameters": {
"jsCode": "for (let i = 0; i < items.length; i++) {\n items[i].json.fileName = `images_${(i + 1).toString().padStart(3, '0')}.png`;\n}\nreturn items;"
},
"typeVersion": 2
},
{
"id": "e04c2a46-a670-4042-88d1-79207731c864",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
540,
300
],
"parameters": {
"options": {
"topK": 40,
"topP": 1,
"temperature": 0.5,
"safetySettings": {
"values": [
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_NONE"
}
]
},
"maxOutputTokens": 65536
},
"modelName": "models/gemini-2.0-flash"
},
"credentials": {
"googlePalmApi": {
"id": "AlDwotqhFT4EfJXQ",
"name": "Google Gemini(PaLM) Api - toan.ngo"
}
},
"typeVersion": 1
},
{
"id": "d2d0e95d-797e-473c-a70f-d8c4cccd32af",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-680,
-760
],
"parameters": {
"width": 520,
"height": 1480,
"content": "## [Agent Circle的N8N工作流] 自动化AI图像生成器 - 立即试用!"
},
"typeVersion": 1
},
{
"id": "cb6fb57a-e3c1-45ff-9b81-4a2152f397fc",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-60,
-200
],
"parameters": {
"color": 7,
"width": 440,
"height": 620,
"content": "## **1. 获取输入**"
},
"typeVersion": 1
},
{
"id": "876439a4-dbfe-4394-96d7-8f6c8a63778d",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
460,
-200
],
"parameters": {
"color": 7,
"width": 420,
"height": 620,
"content": "## **2. 使用Google Gemini图像模型生成图像**"
},
"typeVersion": 1
},
{
"id": "ac07f44c-c881-4d80-bd65-a8aa0ce39375",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1540,
-200
],
"parameters": {
"color": 7,
"width": 540,
"height": 620,
"content": "## **4. 预览并保存图像**"
},
"typeVersion": 1
},
{
"id": "fdd981c2-2659-4a31-b37f-b5c4cd51ee3c",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
940,
-200
],
"parameters": {
"color": 7,
"width": 520,
"height": 620,
"content": "## **3. 准备可用于预览和保存的最终图像**"
},
"typeVersion": 1
},
{
"id": "3a150703-2a7f-4255-9da0-6a15c005290c",
"name": "AI Agent - 根据提示创建图片",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
540,
100
],
"parameters": {
"text": "={{ $('When chat message received').item.json.chatInput }}",
"options": {
"systemMessage": "=You are an AI image‑prompt creation expert. Please create a post using the following JSON format:\nAI Image Generation Prompt Guidelines:\nObjective\nCreate highly realistic, high‐quality images\nEnsure the image content faithfully conveys the spirit of the original text\nIntegrate short text (10–20 characters) naturally into the image\nMaintain consistency and professionalism\n\nStandard Prompt Structure\n[Main Scene] | [Key Elements] | [Text Integration] | [Lighting & Atmosphere] | [Technical Parameters] | [Style Parameters]\n\nComponent Breakdown\n1. Main Scene (Weight ::8)\nDescribe the primary setting in line with the content.\nExamples:\nTech news: “modern tech office setting, minimalist workspace”\nEconomy news: “professional financial district, corporate environment”\nEducation news: “modern classroom, advanced learning environment”\n\n2. Key Elements (Weight ::8)\nList the main visual elements required.\nExamples:\n“large HD display showing text ‘AI Ethics’ in modern typography”\n“professional people in business attire discussing around interactive screen”\n“detailed infographic elements floating in augmented reality style”\n\n3. Text Integration (Weight ::7)\nHow to display text within the image:\ntext elements | elegant typography, clear readable text, integrated naturally into scene ::7\n\n4. Lighting & Atmosphere (Weight ::7)\nlighting | cinematic dramatic lighting, natural ambient light, professional studio setup ::7\nbackground | depth of field blur, clean professional environment ::6\n\n5. Technical Parameters\nparameters | 8k resolution, hyperrealistic, photorealistic quality, octane render, cinematic composition --ar 16:9\nsettings | sharp focus, high detail, professional photography --s 1000 --q 2\nComplete Examples\nExample 1: AI Ethics News\nprofessional tech conference room | large display showing \"AI Ethics Now\" in modern typography, group of diverse executives in discussion ::8 | clean modern workspace, glass walls, tech atmosphere ::7 | cinematic lighting, natural window light ::7 | 8k resolution, hyperrealistic quality, octane render --ar 16:9 --s 1000 --q 2\nExample 2: Financial Market News\nmodern stock exchange environment | giant LED wall showing \"Market Alert\" in bold typography, professional traders in action ::8 | dynamic financial data visualization, sleek modern interior ::7 | dramatic lighting, blue-tinted atmosphere ::7 | 8k resolution, photorealistic quality --ar 16:9 --s 1000 --q 2\n\nAdditional Parameters\n--chaos [0–100]: Adjust randomness\n--stylize [0–1000]: Degree of stylization\n--seed [number]: Ensure consistency across generations\n--niji: Optimized for Asian‐style aesthetics\n--v 5.2: Use the latest model version\n\nImportant Notes\nText in Image\nKeep it short and legible\nUse professional fonts\nIntegrate naturally into the scene\n\nComposition\nFollow the rule of thirds\nEnsure a clear focal point\nBalance text and imagery\n\nColor\nMatch a professional tone\nProvide sufficient contrast for readability\nMaintain visual consistency\n\nTechnical Details\nAlways use high resolution (8k)\nEnsure professional lighting\nOptimize for sharpness and detail\n\nCommon Pitfalls to Avoid\nOverly generic prompts\nMissing text‐integration guidance\nFailing to specify composition rules\nOmitting key technical parameters\n\nThe structure is:\n{\n prompt_image {prompt : \"\" , ...}\n}"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.7
},
{
"id": "a3e5fa40-51c1-41fa-83cb-d6d598f1ff49",
"name": "Telegram 响应",
"type": "n8n-nodes-base.telegram",
"disabled": true,
"position": [
1820,
0
],
"webhookId": "ca4806ac-202c-4709-92f9-6484397c17c4",
"parameters": {
"operation": "sendPhoto",
"binaryData": true,
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "haaaQCcDSaJAtymy",
"name": "Telegram account - hoanglt"
}
},
"typeVersion": 1.2
},
{
"id": "f7059ea5-106b-4b73-8cb3-b0e10e1c0c13",
"name": "保存图像到磁盘",
"type": "n8n-nodes-base.readWriteFile",
"disabled": true,
"position": [
1820,
200
],
"parameters": {
"options": {},
"fileName": "=/files/{{ $('Code').item.json.fileName }}",
"operation": "write"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "4f99fd43-197e-47dc-8a5a-5a4c85fdebe9",
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "Fields - Set Values",
"type": "main",
"index": 0
}
]
]
},
"Code - Clean Json": {
"main": [
[
{
"node": "Code - Get Prompt",
"type": "main",
"index": 0
}
]
]
},
"Code - Get Prompt": {
"main": [
[
{
"node": "Code - Set Filename",
"type": "main",
"index": 0
}
]
]
},
"Code - Set Filename": {
"main": [
[
{
"node": "HTTP Request - Create Image",
"type": "main",
"index": 0
}
]
]
},
"Fields - Set Values": {
"main": [
[
{
"node": "AI Agent - Create Image From Prompt",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent - Create Image From Prompt",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Fields - Set Values",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Create Image": {
"main": [
[
{
"node": "Save Image To Disk",
"type": "main",
"index": 0
},
{
"node": "Telegram Response",
"type": "main",
"index": 0
}
]
]
},
"AI Agent - Create Image From Prompt": {
"main": [
[
{
"node": "Code - Clean Json",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
每日体育摘要
使用Google Gemini、Kokoro TTS和FFmpeg将RSS源转换为播客
If
Set
Code
+12
34 节点Jonas
内容创作
AI驱动的学术作业生成器
使用Google Gemini生成学术作业并通过Telegram/PDF交付
Set
Code
Wait
+9
17 节点Davidson Ahuruezenma
内容创作
使用Gemini 2.5 Pro和TwelveData通过Telegram机器人生成股票交易信号
使用Gemini 2.5 Pro和TwelveData通过Telegram机器人生成股票交易信号
Set
Code
Wait
+9
36 节点Malik Hashir
内容创作
美甲沙龙:主代理V2 Telegram版
集成Telegram、Claude和GPT5-mini的多智能体沙龙预约管理系统
If
Set
Code
+19
67 节点Denis
内容创作
Nano Banana-Gemini 2.5多模态Telegram机器人
基于Nano Banana/Gemini 2.5的多模态Telegram机器人
If
Set
Code
+11
36 节点Denis
内容创作
使用 NanoBanana、Kling 和 LATE Publishing_Bilsimaging 生成产品品牌动画
使用 Gemini AI、Kling 和 LATE 将产品照片转换为社交媒体视频
If
Set
Code
+13
83 节点Bilel Aroua
内容创作
工作流信息
难度等级
高级
节点数量16
分类2
节点类型10
作者
Agent Circle
@agentcircleAgent Circle - A growing marketplace of AI agents, workflows, and toolkits — built to help teams automate smarter and scale faster
外部链接
在 n8n.io 查看 →
分享此工作流