使用OpenAI的GPT-Image-1模型生成和编辑图像
中级
这是一个Design, AI领域的自动化工作流,包含 11 个节点。主要使用 HttpRequest, ConvertToFile, ManualTrigger 等节点,结合人工智能技术实现智能自动化。 使用OpenAI的GPT-Image-1模型生成和编辑图像
前置要求
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "96b96d0aa1e4ff5d5b6779332b149e3ef3364191562d79083d0309cf3ddfa53e"
},
"nodes": [
{
"id": "0e78a29e-87ba-4665-84c1-a413c45e25dc",
"name": "当点击“测试工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-420,
-40
],
"parameters": {},
"typeVersion": 1
},
{
"id": "fe7b054a-e0c9-4642-a97f-6bec60a1ec55",
"name": "编辑图片(OpenAI)",
"type": "n8n-nodes-base.httpRequest",
"position": [
500,
-40
],
"parameters": {
"url": "https://api.openai.com/v1/images/edits",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "image",
"parameterType": "formBinaryData",
"inputDataFieldName": "data"
},
{
"name": "prompt",
"value": "add a mask with horns"
},
{
"name": "model",
"value": "gpt-image-1"
},
{
"name": "n",
"value": "1"
},
{
"name": "size",
"value": "1024x1024"
},
{
"name": "quality",
"value": "high"
}
]
},
"nodeCredentialType": "openAiApi"
},
"credentials": {
"openAiApi": {
"id": "JyI0PkPec1FrpMkt",
"name": "OpenAi AIFB account"
}
},
"typeVersion": 4.2
},
{
"id": "1e1df05c-d8f9-4033-87ee-70be344ab961",
"name": "创建图片调用",
"type": "n8n-nodes-base.httpRequest",
"position": [
-120,
-40
],
"parameters": {
"url": "https://api.openai.com/v1/images/generations",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "model",
"value": "gpt-image-1"
},
{
"name": "prompt",
"value": "A cute red panda like dark super hero"
},
{
"name": "n",
"value": "={{Number(1)}}"
},
{
"name": "size",
"value": "1024x1024"
},
{
"name": "moderation",
"value": "low"
},
{
"name": "background",
"value": "auto"
}
]
},
"nodeCredentialType": "openAiApi"
},
"credentials": {
"openAiApi": {
"id": "JyI0PkPec1FrpMkt",
"name": "OpenAi AIFB account"
}
},
"typeVersion": 4.2
},
{
"id": "4c44da91-0d12-4e7f-bc89-5accddd837d7",
"name": "将JSON二进制转换为文件",
"type": "n8n-nodes-base.convertToFile",
"position": [
200,
-40
],
"parameters": {
"options": {
"fileName": "name_example",
"mimeType": "image/png"
},
"operation": "toBinary",
"sourceProperty": "data[0].b64_json"
},
"typeVersion": 1.1
},
{
"id": "3b8936b7-f0a2-4776-b10a-f06ceb9af31d",
"name": "将JSON二进制转换为最终文件",
"type": "n8n-nodes-base.convertToFile",
"position": [
820,
-40
],
"parameters": {
"options": {
"fileName": "",
"mimeType": "image/png"
},
"operation": "toBinary",
"sourceProperty": "data[0].b64_json"
},
"typeVersion": 1.1
},
{
"id": "3d3238d5-6040-4b74-8e6a-9e1e64198099",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-500,
-200
],
"parameters": {
"height": 320,
"content": "### 🧪 手动触发器"
},
"typeVersion": 1
},
{
"id": "c3378100-f688-4199-a038-83b9220afa91",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-200,
-320
],
"parameters": {
"color": 3,
"width": 280,
"height": 440,
"content": "### 🎨 图片生成(OpenAI)"
},
"typeVersion": 1
},
{
"id": "82a880de-74de-44e5-8448-f487c9376d0e",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
-200
],
"parameters": {
"color": 5,
"width": 280,
"height": 320,
"content": "### 🧾 将base64转换为文件"
},
"typeVersion": 1
},
{
"id": "42ccb29f-b820-4791-9683-4eb0f00ff2d3",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
420,
-320
],
"parameters": {
"color": 3,
"width": 280,
"height": 440,
"content": "### ✏️ 图片编辑(OpenAI)"
},
"typeVersion": 1
},
{
"id": "4c8846ab-b3f2-4c7c-9283-5a40a55b816d",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
740,
-240
],
"parameters": {
"color": 5,
"width": 280,
"height": 360,
"content": "### 🧾 最终转换(base64 → 文件)"
},
"typeVersion": 1
},
{
"id": "2b2533f8-b7aa-4499-970e-9b0546b73c0e",
"name": "便利贴5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1240,
-860
],
"parameters": {
"color": 6,
"width": 700,
"height": 980,
"content": "## 🧠 图片AI工作流概述"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Create image call": {
"main": [
[
{
"node": "Convert json binary to File",
"type": "main",
"index": 0
}
]
]
},
"Edit Image (OpenAI)": {
"main": [
[
{
"node": "Convert json binary to File final",
"type": "main",
"index": 0
}
]
]
},
"Convert json binary to File": {
"main": [
[
{
"node": "Edit Image (OpenAI)",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Create image call",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 设计, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
第8集:Instagram影响者
使用GPT-4.1、Supabase和人工审批自动化Instagram影响者内容
If
Set
Gmail
+10
55 节点NICKYAI
设计
自动Instagram内容规划与发布
使用OpenAI和内容日历自动规划并发布Instagram内容
If
Set
Gmail
+10
54 节点AYOUBTIG
设计
构建基于n8n和Gemini AI图像编辑的图像修复服务
构建基于n8n和Gemini AI图像编辑的图像修复服务
Set
Split Out
Google Drive
+5
17 节点Jimleuk
设计
使用 n8n 和 Gemini AI 图像编辑拼接分离图像
使用 n8n 和 Gemini AI 图像编辑拼接分离图像
Set
Merge
Aggregate
+6
20 节点Jimleuk
设计
第8集:Instagram 影响者
使用 OpenAI 和 FB Graph API 创建自动化 Instagram 内容生成器
If
Set
Gmail
+10
55 节点jolonbankey
设计
使用 ComfyUI 生成 AI 媒体:图像、视频、3D 和音频桥接
使用 ComfyUI 生成 AI 媒体:图像、视频、3D 和音频桥接
If
Set
Code
+14
51 节点Nielo
设计
工作流信息
难度等级
中级
节点数量11
分类2
节点类型4
作者
Edoardo Guzzi
@mredodosAutomation expert with 10+ years in programming, AI, Chrome extensions, and mobile apps. Specializing in PHP, JS, and Python, I design custom n8n workflows to streamline processes and boost productivity. Explore my templates or contact me for tailored solutions.
外部链接
在 n8n.io 查看 →
分享此工作流