使用APImage AI移除图像背景:Airtable至Google Drive

中级

这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 14 个节点。主要使用 Code、Airtable、SplitOut、GoogleDrive、HttpRequest 等节点。 使用APImage AI移除图像背景:Airtable至Google Drive

前置要求
  • Airtable API Key
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "cba9e349b601c19a1409b9fd06680aff0a77829be13c8aad9a858d4cea7ff290",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "984abb02-168c-4f0d-8b5f-c45e3c15358c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -80
      ],
      "parameters": {
        "width": 416,
        "height": 252,
        "content": "### ✨1. 如何开始"
      },
      "typeVersion": 1
    },
    {
      "id": "319e2532-7350-4f8c-9f76-1abed7a9481b",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        576
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 228,
        "content": "### 🧩 3. 如何扩展或自定义"
      },
      "typeVersion": 1
    },
    {
      "id": "a1ab1aa1-5b9f-4ec1-8ee1-ba0fcdbc3af2",
      "name": "获取记录",
      "type": "n8n-nodes-base.airtable",
      "position": [
        288,
        304
      ],
      "parameters": {
        "id": "=",
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appYCwSqo6Q1lGUah",
          "cachedResultUrl": "https://airtable.com/appYCwSqo6Q1lGUah",
          "cachedResultName": "Creatives Library"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblbA4dbCU9q6wQEw",
          "cachedResultUrl": "https://airtable.com/appYCwSqo6Q1lGUah/tblbA4dbCU9q6wQEw",
          "cachedResultName": "Media Files"
        },
        "options": {}
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "L3ICSq26N8sj3bWe",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d2a9e1a0-4490-4f09-ad98-d72126ab346f",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        512,
        304
      ],
      "parameters": {
        "jsCode": "const inputData = $input.all();\nconst outputItems = [];\n\nfor (const item of inputData) {\n  if (item.json.records && Array.isArray(item.json.records)) {\n    \n    for (const record of item.json.records) {\n      if (record.fields?.Thumbnail?.[0]?.url) {\n        const thumbnail = record.fields.Thumbnail[0];\n        \n        // Wähle die beste Thumbnail-Qualität\n        let thumbnailUrl = thumbnail.url;\n        if (thumbnail.thumbnails?.large?.url) {\n          thumbnailUrl = thumbnail.thumbnails.large.url;\n        } else if (thumbnail.thumbnails?.full?.url) {\n          thumbnailUrl = thumbnail.thumbnails.full.url;\n        }\n        \n        outputItems.push({\n          json: {\n            // Original Record Info\n            recordId: record.id,\n            fileName: record.fields['File Name'] || 'Unknown',\n            mediaType: record.fields['Media Type'] || 'Unknown',\n            uploadDate: record.fields['Upload Date'],\n            fileSize: record.fields['File Size'],\n            \n            // Thumbnail Info\n            originalThumbnailUrl: thumbnailUrl,\n            thumbnailId: thumbnail.id,\n            \n            // Processing Status\n            step: 'ready_for_bg_removal',\n            processedAt: new Date().toISOString(),\n            \n            // Für Dateiname-Generierung\n            cleanFileName: (record.fields['File Name'] || 'unknown')\n              .replace(/[^a-zA-Z0-9]/g, '_')\n              .toLowerCase()\n          }\n        });\n      }\n    }\n  }\n}\n\nconsole.log(`${outputItems.length} Thumbnails für Verarbeitung vorbereitet`);\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "8c127d1b-b439-48b7-ad58-17ac9d9536af",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        736,
        304
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "originalThumbnailUrl"
      },
      "typeVersion": 1
    },
    {
      "id": "fa4b68bb-e223-4ca7-bc64-0b29929910e3",
      "name": "下载",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1184,
        304
      ],
      "parameters": {
        "url": "={{ $json.processed_image_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "018f9383-1384-4e75-ae59-f3c09865a7fe",
      "name": "上传文件",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1408,
        304
      ],
      "parameters": {
        "name": "bg_removal",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "e7a3de31-993c-4fc4-b243-32b25c841878",
      "name": "APImage API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        960,
        304
      ],
      "parameters": {
        "url": "https://apimage.org/api/ai-remove-background",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "image_url",
              "value": "={{ $json.originalThumbnailUrl }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5a7ae8df-2f88-43c5-8b35-de50f8389276",
      "name": "Remove Background",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        64,
        304
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b13ebf15-d26d-4bbd-96f1-8be97ad0c9c3",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        192
      ],
      "parameters": {
        "color": 4,
        "width": 416,
        "height": 368,
        "content": "### ⚡ 2. 核心功能"
      },
      "typeVersion": 1
    },
    {
      "id": "583b449b-e849-43b6-9cbb-d6569b65f9a3",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        192
      ],
      "parameters": {
        "width": 880,
        "height": 368,
        "content": "### 自定义此部分"
      },
      "typeVersion": 1
    },
    {
      "id": "33df6512-8693-4eee-9695-cb01e521aea7",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        192
      ],
      "parameters": {
        "width": 256,
        "height": 368,
        "content": "### 自定义此部分"
      },
      "typeVersion": 1
    },
    {
      "id": "018cdce1-5705-41db-aa61-2d53ddf865a3",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -176
      ],
      "parameters": {
        "width": 416,
        "height": 80,
        "content": "# 从这里开始"
      },
      "typeVersion": 1
    },
    {
      "id": "83725205-b574-4066-8cfc-066b01abbab7",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        816
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 4576,
        "content": "### 📃 4. 完整工作流文档"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "APImage API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "APImage API": {
      "main": [
        [
          {
            "node": "Download",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a record": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Background": {
      "main": [
        [
          {
            "node": "Get a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个中级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

需要付费吗?

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

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

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

作者
Gegenfeld

Gegenfeld

@gegenfeld

We at Gegenfeld are an EdTech platform dedicated to delivering high-quality on-demand courses and interactive training sessions for professional development at all skill levels. With our commitment to "Accelerate your future," we empower professionals to enhance their expertise through engaging, industry-focused learning experiences. On n8n, we share some of the workflows used in our interactive training to provide deeper insights and practical applications.

外部链接
在 n8n.io 上查看 →

分享此工作流