使用 APImage 自动替换和重照明任何图像的背景
这是一个Miscellaneous、Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 FormTrigger、GoogleDrive、HttpRequest 等节点。 使用 APImage 自动替换和重照明任何图像的背景
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
使用的节点 (10 个)
{
"meta": {
"instanceId": "47d295a7329d3547e0e6b56de9e439dc1a0a49c6d827b2320629f54300c47e41"
},
"nodes": [
{
"id": "15ab6203-2c77-45ac-b5dd-79f404e090fa",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-140
],
"parameters": {
"width": 1220,
"height": 300,
"content": "## 🡫 如何开始"
},
"typeVersion": 1
},
{
"id": "8cb25cf6-2de1-4a8a-b39f-dd3d277ef96e",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
920,
180
],
"parameters": {
"color": 4,
"width": 300,
"height": 1160,
"content": "### 输出图像"
},
"typeVersion": 1
},
{
"id": "1024a4b1-eecb-4fbd-8740-5ce45f238df0",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
180
],
"parameters": {
"color": 4,
"width": 280,
"height": 1160,
"content": "### 输入图像"
},
"typeVersion": 1
},
{
"id": "daaec5d9-342d-4f2f-85d2-0ca1a072dd4c",
"name": "下载图像",
"type": "n8n-nodes-base.httpRequest",
"position": [
700,
380
],
"parameters": {
"url": "={{ $json.data.url }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "3f76cef0-807e-42e7-9a6f-4d078e86aada",
"name": "APImage API",
"type": "n8n-nodes-base.httpRequest",
"position": [
400,
380
],
"parameters": {
"url": "https://apimage.org/api/ai-replace-background",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "image_url",
"value": "={{ $json[\"Image URL\"] }}"
},
{
"name": "background_prompt",
"value": "={{ $json[\"Background Description\"] }}"
},
{
"name": "preserve_subject",
"value": "0.8"
},
{
"name": "light_direction",
"value": "above"
},
{
"name": "light_strength",
"value": "0.6"
},
{
"name": "output_format",
"value": "png"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_API_KEY_HERE"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "ad8c0911-3d2b-4acb-ad4c-8b96e556e0d0",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
180
],
"parameters": {
"color": 4,
"width": 280,
"height": 460,
"content": "### 替换 + 重新打光背景"
},
"typeVersion": 1
},
{
"id": "ad068051-dcbe-49f9-8345-f42f1edc754c",
"name": "便签 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
600,
180
],
"parameters": {
"color": 4,
"width": 300,
"height": 460,
"content": "### 下载图像"
},
"typeVersion": 1
},
{
"id": "07ef7110-3d9e-4773-96f2-6f6c2143a012",
"name": "便签 5",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
660
],
"parameters": {
"width": 600,
"height": 680,
"content": "### 常见问题"
},
"typeVersion": 1
},
{
"id": "3d8afd28-2752-4145-bfdf-29c64e59af3b",
"name": "替换背景(节点可替换)",
"type": "n8n-nodes-base.formTrigger",
"position": [
80,
380
],
"webhookId": "b7487db2-4581-4fd6-b4e0-afac3d8466fb",
"parameters": {
"options": {},
"formTitle": "APImage Replace Background",
"formFields": {
"values": [
{
"fieldLabel": "Image URL",
"placeholder": "https://example.com/product-image.png",
"requiredField": true
},
{
"fieldLabel": "Background Description",
"placeholder": "a modern office with natural lighting",
"requiredField": true
}
]
},
"formDescription": "Replaces the background of images"
},
"typeVersion": 2.2
},
{
"id": "2f066144-49d7-4f26-8278-fc778e4f37d4",
"name": "存储输出图像(节点可替换)",
"type": "n8n-nodes-base.googleDrive",
"position": [
1020,
380
],
"parameters": {
"name": "data",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
}
},
"typeVersion": 3
}
],
"pinData": {},
"connections": {
"APImage API": {
"main": [
[
{
"node": "Download Image",
"type": "main",
"index": 0
}
]
]
},
"Download Image": {
"main": [
[
{
"node": "Store the output image (node can be exchanged)",
"type": "main",
"index": 0
}
]
]
},
"Replace Background (node can be exchanged)": {
"main": [
[
{
"node": "APImage API",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于Miscellaneous、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Gegenfeld
@gegenfeldWe 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.
分享此工作流