8
n8n 中文网amn8n.com

发型预览导出

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Webhook, FormTrigger, HttpRequest, ConvertToFile 等节点。 基于OpenAI的AI发型预览生成器与LINE群组分享

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "3nvbG23fEvkCCBSy",
  "meta": {
    "instanceId": "9101df148a9ab5ba09dd343a0c584806dbd6c3b74e74be8e97699184269b6877",
    "templateCredsSetupCompleted": true
  },
  "name": "export_hairstyle-preview",
  "tags": [],
  "nodes": [
    {
      "id": "b6cf5de7-a5ef-47ae-9423-1c4afe97888e",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -144,
        0
      ],
      "webhookId": "3445cfdf-3bc9-4548-bd5c-bf5d20e7b089",
      "parameters": {
        "options": {},
        "formTitle": "Hairstyle Preview",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "pic",
              "multipleFiles": false,
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "content",
              "requiredField": true
            }
          ]
        },
        "authentication": "basicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "2Xi9J8KKgilhioyb",
          "name": "Unnamed credential"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ebb4764a-c163-4d9b-a2b7-65d64e1f4acd",
      "name": "Create Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        96,
        0
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/images/edits",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "=Keep the person's face exactly the same as in the input image. Do not alter or replace the face. \nOnly modify the hairstyle. Make sure the hairstyle looks natural and realistic. \nThe overall identity of the person must remain unchanged.\n\nUser request: {{ $json.content }}"
            },
            {
              "name": "model",
              "value": "gpt-image-1"
            },
            {
              "name": "size",
              "value": "1024x1536"
            },
            {
              "name": "image",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "pic"
            },
            {
              "name": "quality",
              "value": "high"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "mO23EZGRXh9cFi9G",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1156faf1-46ee-45ab-ac91-0325f735be62",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        336,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "data[0].b64_json"
      },
      "typeVersion": 1.1
    },
    {
      "id": "ae98386d-cc94-49dd-a8dd-7a042f976fd8",
      "name": "上传图像",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        592,
        0
      ],
      "parameters": {
        "url": "https://api.cloudinary.com/v1_1/{{CLOUDINARY_CLOUD_NAME}}/image/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            },
            {
              "name": "upload_preset",
              "value": "{{CLOUDINARY_UPLOAD_PRESET}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "399838c0-b325-4f28-bf43-ff45a54d54aa",
      "name": "LINE 输出",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        0
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/push",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n\"to\": \"{{LINE_GROUP_ID}}\",\n\"messages\": [\n{\n  \"type\": \"image\",\n  \"originalContentUrl\": \"{{ $json.secure_url }}\",\n  \"previewImageUrl\": \"{{ $json.secure_url }}\"\n}\n]\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{LINE_CHANNEL_TOKEN}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "71b229c4-bbf4-4b1a-a463-9898f7a2dee5",
      "name": "LINE 输入",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -16,
        448
      ],
      "webhookId": "01d98d79-2c96-4a75-a4e1-b2faddb8d0a6",
      "parameters": {
        "path": "01d98d79-2c96-4a75-a4e1-b2faddb8d0a6",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "2d679cdf-83b1-4a32-9a15-08ad8ee93de1",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -128
      ],
      "parameters": {
        "color": 5,
        "width": 560,
        "height": 896,
        "content": "# 发型预览与 LINE 群组分享"
      },
      "typeVersion": 1
    },
    {
      "id": "49d75f49-9a26-47a4-ae78-37f5db81b08d",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        224
      ],
      "parameters": {
        "color": 3,
        "width": 464,
        "height": 384,
        "content": "## 请使用此节点获取 LINE 群组 ID"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7b478bb1-7e58-47aa-be3e-f002aa8e404a",
  "connections": {
    "Create Image": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Image": {
      "main": [
        [
          {
            "node": "LINE output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Upload Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Create Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
kote2

kote2

@kote2

I share practical examples and ideas for AI automation using tools like n8n, explained in a way that’s easy for beginners to understand. While Dify is currently more well-known in Japan, n8n complements it and is expected to gain even more attention in the future. This channel aims to be a practical guide you can rely on when that wave of popularity arrives. That said, I’m still learning too—so let’s learn and grow together!

外部链接
在 n8n.io 查看

分享此工作流