8
n8n 中文网amn8n.com

使用OpenAI编辑图像

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 Set, Telegram, FormTrigger, GoogleDrive, HttpRequest 等节点。 使用DALL-E 2编辑图像并通过Google Drive和Telegram发送

前置要求
  • Telegram Bot Token
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "e2a9WLWDqS85I1AX",
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
  },
  "name": "使用 OPEN AI 编辑图像",
  "tags": [],
  "nodes": [
    {
      "id": "0b9585d8-e520-4ed2-9c63-de16fdcfdf50",
      "name": "🚀 表单提交触发器",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        380,
        280
      ],
      "webhookId": "f9d60b5f-0a09-4654-a840-84a0f745321e",
      "parameters": {
        "options": {},
        "formTitle": "AI Image Editor",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "image",
              "multipleFiles": false,
              "requiredField": true
            },
            {
              "fieldLabel": "prompt",
              "placeholder": "Describe the edits you want (e.g., 'remove background', 'add sunglasses', 'change to winter scene')",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Upload your image and describe the edits you want to make. Our AI will process your image and deliver the results instantly via Telegram."
      },
      "typeVersion": 2.2
    },
    {
      "id": "8fcc87f1-f2c0-4bbd-b1be-3baf1f154f67",
      "name": "⚙️ 配置变量",
      "type": "n8n-nodes-base.set",
      "position": [
        640,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "google_drive_folder_id",
              "name": "google_drive_folder_id",
              "type": "string",
              "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID"
            },
            {
              "id": "telegram_chat_id",
              "name": "telegram_chat_id",
              "type": "string",
              "value": "YOUR_TELEGRAM_CHAT_ID"
            },
            {
              "id": "image_size",
              "name": "image_size",
              "type": "string",
              "value": "1024x1024"
            },
            {
              "id": "openai_model",
              "name": "openai_model",
              "type": "string",
              "value": "dall-e-2"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "877c3e0f-8566-438c-bf69-8e7ccdb9dfe3",
      "name": "📁 上传原图到 Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        880,
        280
      ],
      "parameters": {
        "name": "=original-{{ $now.format('yyyy-MM-dd-HHmmss') }}.png",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('⚙️ Configuration Variables').item.json.google_drive_folder_id }}"
        },
        "inputDataFieldName": "image"
      },
      "typeVersion": 3
    },
    {
      "id": "4742b2b8-5c56-468f-98b2-b1f2ea908702",
      "name": "📥 下载用于处理",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1140,
        280
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "typeVersion": 3
    },
    {
      "id": "c8008016-1d32-415b-a59b-0858d8f5887e",
      "name": "🎨 AI 图像编辑器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1380,
        280
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/images/edits",
        "method": "POST",
        "options": {
          "timeout": 60000
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "image",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            },
            {
              "name": "prompt",
              "value": "={{ $('🚀 Form Submission Trigger').item.json.prompt }}"
            },
            {
              "name": "model",
              "value": "={{ $('⚙️ Configuration Variables').item.json.openai_model }}"
            },
            {
              "name": "size",
              "value": "={{ $('⚙️ Configuration Variables').item.json.image_size }}"
            },
            {
              "name": "n",
              "value": "1"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "5c8753f1-43cf-45d5-a984-69232a14adac",
      "name": "🔄 转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1640,
        280
      ],
      "parameters": {
        "options": {
          "fileName": "=edited-{{ $now.format('yyyy-MM-dd-HHmmss') }}.png",
          "mimeType": "image/png"
        },
        "operation": "toBinary",
        "sourceProperty": "data[0].url"
      },
      "typeVersion": 1.1
    },
    {
      "id": "dd69866a-1439-4ad7-8e20-5e6eeccb3e2e",
      "name": "📱 发送到 Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1880,
        280
      ],
      "webhookId": "9b429508-63ad-471c-b8b5-ce71400ac43e",
      "parameters": {
        "chatId": "={{ $('⚙️ Configuration Variables').item.json.telegram_chat_id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "14fd976d-849b-4b6c-b4f7-bb12d21da68d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        40
      ],
      "parameters": {
        "width": 569,
        "height": 1304,
        "content": "# 🎨 AI 图像编辑器工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "e8b0837c-bd0e-4184-a42a-13ce73837e29",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 200,
        "height": 308,
        "content": "💡 **步骤 1:表单提交**"
      },
      "typeVersion": 1
    },
    {
      "id": "04947555-cd06-4c6c-9f01-43aab9dcd821",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        160
      ],
      "parameters": {
        "color": 3,
        "width": 200,
        "height": 248,
        "content": "⚙️ **步骤 2:配置**"
      },
      "typeVersion": 1
    },
    {
      "id": "4f504b1e-73c9-4d62-b7bf-41a83087d68a",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        160
      ],
      "parameters": {
        "color": 6,
        "width": 200,
        "height": 248,
        "content": "📁 **步骤 3:备份存储**"
      },
      "typeVersion": 1
    },
    {
      "id": "e065914a-070c-48bd-ac65-e9c666478e78",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        160
      ],
      "parameters": {
        "color": 3,
        "width": 200,
        "height": 248,
        "content": "📥 **步骤 4:准备 AI 处理**"
      },
      "typeVersion": 1
    },
    {
      "id": "0a9ffa00-4432-497d-98cb-d74e9320fcc7",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        160
      ],
      "parameters": {
        "color": 6,
        "width": 200,
        "height": 248,
        "content": "🎨 **步骤 5:AI 魔法**"
      },
      "typeVersion": 1
    },
    {
      "id": "30d577e2-9c74-46b9-b62e-7b7a24aca423",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1540,
        160
      ],
      "parameters": {
        "color": 2,
        "width": 200,
        "height": 268,
        "content": "🔄 **步骤 6:文件转换**"
      },
      "typeVersion": 1
    },
    {
      "id": "97a064c2-60cb-4e8c-bfda-d81356c7918c",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1780,
        160
      ],
      "parameters": {
        "color": 6,
        "width": 200,
        "height": 228,
        "content": "📱 **步骤 7:即时交付**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9dce616c-0e79-4fea-b905-50aa27e1f0a8",
  "connections": {
    "🎨 AI Image Editor": {
      "main": [
        [
          {
            "node": "🔄 Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔄 Convert to File": {
      "main": [
        [
          {
            "node": "📱 Send to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📥 Download for Processing": {
      "main": [
        [
          {
            "node": "🎨 AI Image Editor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🚀 Form Submission Trigger": {
      "main": [
        [
          {
            "node": "⚙️ Configuration Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📁 Upload Original to Drive": {
      "main": [
        [
          {
            "node": "📥 Download for Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Configuration Variables": {
      "main": [
        [
          {
            "node": "📁 Upload Original to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量15
分类2
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
David Olusola

David Olusola

@dae221

AI automation consultant working with ambitious businesses on their most complex operational challenges. For project inquiries, reach me at david@daexai.com

外部链接
在 n8n.io 查看

分享此工作流