8
n8n 中文网amn8n.com

使用 GPT-4o、FAL Flux 和 Google Drive 生成品牌文章图片

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Code, Wait, Merge 等节点。 使用 GPT-4o、FAL Flux 和 Google Drive 生成品牌文章图片

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "783d2046f405cc6ecb20ef185376ed1023323a3da628b9d8156b1fb75c75e037",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "001a2632-587f-4cb8-a7a0-0fbd0f1b4f48",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1040,
        3648
      ],
      "webhookId": "4023120e-b7d7-4ae5-89e5-fc42b4556910",
      "parameters": {
        "amount": 2
      },
      "typeVersion": 1.1
    },
    {
      "id": "b0a4dae6-2763-4067-bba2-e9ab0bc6b6b8",
      "name": "合并2",
      "type": "n8n-nodes-base.merge",
      "position": [
        -960,
        3968
      ],
      "parameters": {},
      "typeVersion": 3.1
    },
    {
      "id": "73e8a5fd-2d1e-4d53-9b2d-2b818f9c80e9",
      "name": "调整徽标大小",
      "type": "n8n-nodes-base.editImage",
      "position": [
        -1168,
        4128
      ],
      "parameters": {
        "width": 68.4,
        "height": 52.6,
        "options": {},
        "operation": "resize"
      },
      "typeVersion": 1
    },
    {
      "id": "282ea827-fe38-4f91-886a-993375a1417d",
      "name": "合并二进制项",
      "type": "n8n-nodes-base.code",
      "position": [
        -720,
        3968
      ],
      "parameters": {
        "jsCode": "const images = $input.all().reduce((acc, item, index) => {\n  acc[`data${index}`] = item.binary.data;\n  return acc;\n}, {});\nreturn [{ json: {}, binary: images }]"
      },
      "typeVersion": 2
    },
    {
      "id": "4b7f2891-54ef-4484-890e-3ee504b87725",
      "name": "If3",
      "type": "n8n-nodes-base.if",
      "position": [
        -720,
        3648
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "949170ea-a72b-4d90-881c-c18ab99a5800",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "956ea698-f008-4fd6-8998-6170ffdb2dfa",
      "name": "点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2000,
        3648
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3a2dcccc-ab9e-434c-8abe-04b673b36b7e",
      "name": "链接图片",
      "type": "n8n-nodes-base.set",
      "position": [
        -1808,
        3648
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b01ca98-98a0-4232-be3b-a0fbc6d9bb52",
              "name": "image_url",
              "type": "string",
              "value": "=https://surecctv.com/uploads/images/2021/07/600x600-1627381898-single_product1-nk1080hir100af.jpg"
            },
            {
              "id": "756cc282-45f1-4e94-a835-9c7ff74b6c21",
              "name": "subject",
              "type": "string",
              "value": "technology"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b89307e1-1e3f-4a4b-a307-dc2f5df6256e",
      "name": "创建生成图片的提示",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1600,
        3648
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "GPT-4O"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Based on the topic: {{ $json.subject }}\n\nCreate an image prompt so I can put it into the Image AI Model to create a sharp, detailed illustration. The image prompt must be under 70 words, sharp and detailed, but no text or logos can be added to the image (Important).\n\nThe size of the article image for the website will be: 800x500 pixels"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "TmPSRVY5JCpWCR5d",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "9f50d697-e11c-4cdb-8834-520d87a3b6f2",
      "name": "生成图片",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1296,
        3648
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/flux/dev/image-to-image",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"prompt\": \"{{ JSON.stringify($json.message.content).slice(1, -1) }}\",\n  \"image_url\": {{JSON.stringify($('Link image').item.json.image_url)}},\n  \"image_size\": {\n    \"width\": 800,\n    \"height\": 500\n  },\n  \"num_inference_steps\": 45,\n  \"guidance_scale\": 4.5,\n  \"num_images\": 1,\n  \"enable_safety_checker\": true\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Key xxxxx"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dee77768-1f9c-44ab-ad5d-025d34e93325",
      "name": "检查图片完成状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -880,
        3648
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/flux/requests/{{ $json.request_id }}/status",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Key xxxx"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d7fa1e0b-af07-48fa-9120-76ad416a46a1",
      "name": "获取图片链接",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -528,
        3632
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/flux/requests/{{ $json.request_id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Key xxxxxx"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b3638dd1-cc34-4361-9129-a5b1fcea8a60",
      "name": "下载图片",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1584,
        3952
      ],
      "parameters": {
        "url": "={{ $json.images[0].url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "9492aab5-5c3d-41f7-80db-dd3826d509e4",
      "name": "调整图片大小",
      "type": "n8n-nodes-base.editImage",
      "position": [
        -1360,
        3952
      ],
      "parameters": {
        "width": 800,
        "options": {},
        "operation": "resize"
      },
      "typeVersion": 1
    },
    {
      "id": "86ff8705-ed79-467d-9e28-30db0a6e94ff",
      "name": "获取公司徽标",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1360,
        4128
      ],
      "parameters": {
        "url": "=https://drive.google.com/uc?export=download&id=xxxxx",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "10b80e05-dc55-4cfd-bd59-c3dc90b9ced7",
      "name": "合成图片和徽标",
      "type": "n8n-nodes-base.editImage",
      "position": [
        -512,
        3968
      ],
      "parameters": {
        "options": {},
        "operation": "composite",
        "positionX": 728,
        "dataPropertyName": "data0",
        "dataPropertyNameComposite": "data1"
      },
      "typeVersion": 1
    },
    {
      "id": "6eb031eb-0500-4574-8a85-d01fa9288582",
      "name": "保存到云端硬盘",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -320,
        3968
      ],
      "parameters": {
        "name": "={{ $('Loop Over Items').first().json.ten }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1PlUL4-0iNYSXi4YTeTN8BfsPcqIxrwh5",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1PlUL4-0iNYSXi4YTeTN8BfsPcqIxrwh5",
          "cachedResultName": "image"
        },
        "inputDataFieldName": "data0"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "7ksMk3zwMvT2CToN",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "e7f70628-ac04-4a6b-8f0f-e512a15acb02",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2640,
        3568
      ],
      "parameters": {
        "color": 5,
        "width": 528,
        "height": 288,
        "content": "## 工作流概览"
      },
      "typeVersion": 1
    },
    {
      "id": "612b71a4-68fd-4ff5-a6f2-7ed682cef523",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2176,
        4064
      ],
      "parameters": {
        "width": 528,
        "height": 336,
        "content": "## 设置清单"
      },
      "typeVersion": 1
    },
    {
      "id": "242f0e7e-6f45-45f8-abbe-f327201bf378",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        4144
      ],
      "parameters": {
        "color": 3,
        "width": 528,
        "height": 288,
        "content": "## 注意事项与提示"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If3": {
      "main": [
        [
          {
            "node": "Get image link",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "check image finish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge2": {
      "main": [
        [
          {
            "node": "Merge Binary Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Link image": {
      "main": [
        [
          {
            "node": "Create prompt for generate image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "resize logo": {
      "main": [
        [
          {
            "node": "Merge2",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "resize image": {
      "main": [
        [
          {
            "node": "Merge2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save on drive": {
      "main": [
        []
      ]
    },
    "Download image": {
      "main": [
        [
          {
            "node": "resize image",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get company's logo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get image link": {
      "main": [
        [
          {
            "node": "Download image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "generate image": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get company's logo": {
      "main": [
        [
          {
            "node": "resize logo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Binary Items": {
      "main": [
        [
          {
            "node": "Composite image and logo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check image finish": {
      "main": [
        [
          {
            "node": "If3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Composite image and logo": {
      "main": [
        [
          {
            "node": "Save on drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create prompt for generate image": {
      "main": [
        [
          {
            "node": "generate image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Link image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

工作流信息
难度等级
高级
节点数量19
分类2
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Cong Nguyen

Cong Nguyen

@cong-nguyen

I’m a developer specialized in building web and mobile applications with AI integration and intelligent automation. With a solid background in data science, I help businesses build smarter digital solutions using cutting-edge technologies.

外部链接
在 n8n.io 查看

分享此工作流