8
n8n 中文网amn8n.com

使用 Real-ESRGAN AI、Google Drive 和 Airtable 批量提升人像照片质量

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 Code, Airtable, GoogleDrive, HttpRequest, ManualTrigger 等节点。 使用 Real-ESRGAN AI、Google Drive 和 Airtable 批量提升人像照片质量

前置要求
  • Airtable API Key
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "9e721f64f4f5b8df656a4e0e1b663225a53ad0de7655a0878df9764d30956485",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "3a204dbb-8945-4fd1-8d09-9980a664128f",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1024,
        -848
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1d9e1318-89b1-436f-abf1-0ea269f35644",
      "name": "创建文件夹",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -768,
        -848
      ],
      "parameters": {
        "name": "=< Folder Name >",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "resource": "folder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "AKldzSoqKzegF8kI",
          "name": "Vertical Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "f44f1434-e002-4478-bbd5-498dff5a8e40",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -64,
        -848
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "af7d12c5-fd15-4ed3-8bf4-11901dc21f89",
      "name": "上传到 Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "onError": "continueRegularOutput",
      "position": [
        832,
        -848
      ],
      "parameters": {
        "name": "={{ 'Upscaled_Picture' + $now.format('yyyy-MM-dd_HH-mm-ss') + '.png' }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.gdriveUploadFolderId }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "AKldzSoqKzegF8kI",
          "name": "Vertical Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "6bab8092-e2a1-4640-acf5-07e4e15d656f",
      "name": "下载放大图片",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        384,
        -928
      ],
      "parameters": {
        "url": "={{ $json.output }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "444a3467-8416-4dfd-ad89-1be387ea4613",
      "name": "从 Airtable 输出中提取肖像 URL",
      "type": "n8n-nodes-base.code",
      "position": [
        -288,
        -848
      ],
      "parameters": {
        "jsCode": "// N8N Code Node - Extract Portrait Photo URLs from Airtable Output\n\n// Input data from Airtable\nconst airtableData = $input.all()[0].json;\n\n// Get Google Drive folder ID from previous node\nconst folderId = $node[\"Create folder\"].json.id;\n\n// Extract URLs from PortraitFotoAuswahl array\nconst portraitUrls = [];\n\nif (airtableData.PortraitFotoAuswahl && Array.isArray(airtableData.PortraitFotoAuswahl)) {\n airtableData.PortraitFotoAuswahl.forEach((item, index) => {\n   if (item.url) {\n     portraitUrls.push({\n       index: index,\n       url: item.url,\n       filename: item.filename || `portrait_${index}`,\n       size: item.size || null,\n       width: item.width || null,\n       height: item.height || null,\n       gdriveUploadFolderId: folderId\n     });\n   }\n });\n}\n\n// Return array of URLs with folder ID\nreturn portraitUrls.map(item => ({\n json: {\n   url: item.url,\n   index: item.index,\n   filename: item.filename,\n   size: item.size,\n   width: item.width,\n   height: item.height,\n   gdriveUploadFolderId: item.gdriveUploadFolderId\n }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "5868126e-c299-4574-9170-ce02655a59ad",
      "name": "Replicate 放大工具",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160,
        -928
      ],
      "parameters": {
        "url": "https://api.replicate.com/v1/predictions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"version\": \"nightmareai/real-esrgan:f121d640bd286e1fdc67f9799164c1d5be36ff74576ee11c803ae5b665dd46aa\",\n  \"input\": {\n    \"image\": \"{{ $json.url }}\",\n    \"scale\": 2,\n    \"face_enhance\": false\n  }\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Prefer",
              "value": "wait"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "FovFPj60gDUn3HP0",
          "name": "Replicate"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "94532da7-1ca5-4d71-b906-677964f0490f",
      "name": "设置 GDrive 上传文件夹 ID",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        -928
      ],
      "parameters": {
        "jsCode": "// Set Node JavaScript Code\nconst currentItem = $input.all()[0];\nconst loopData = $node[\"Loop Over Items\"].json;\n\nreturn [{\n  json: {\n    gdriveUploadFolderId: loopData.gdriveUploadFolderId,\n    originalFilename: loopData.filename,\n    originalIndex: loopData.index\n  },\n  binary: currentItem.binary\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "711fea9d-9b12-48cb-b66f-2fa75b014142",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        -976
      ],
      "parameters": {
        "color": 4,
        "width": 304,
        "height": 368,
        "content": "## 信息"
      },
      "typeVersion": 1
    },
    {
      "id": "97297413-8022-4966-8117-944edf4736fc",
      "name": "从图片中获取记录",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -496,
        -848
      ],
      "parameters": {
        "id": "=< enter Record ID >",
        "base": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "options": {}
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "yPMIQY5qCFGtB5FX",
          "name": "Book your fantasy Airtable"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "45e45d37-8afc-48a2-ab4b-557b985c9741",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -960
      ],
      "parameters": {
        "height": 352,
        "content": "## 从存储数据输入记录"
      },
      "typeVersion": 1
    },
    {
      "id": "73b660f8-f518-42d8-8970-234a956f412a",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -960
      ],
      "parameters": {
        "height": 352,
        "content": "## 添加文件夹名称"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Create folder": {
      "main": [
        [
          {
            "node": "Get Record from Pictures",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Replicate Upscaler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Upscale": {
      "main": [
        [
          {
            "node": "Set GDrive Upload Folder ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replicate Upscaler": {
      "main": [
        [
          {
            "node": "Download Upscale",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Record from Pictures": {
      "main": [
        [
          {
            "node": "Extract Portrait URLS from Airtable Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set GDrive Upload Folder ID": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Create folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Portrait URLS from Airtable Output": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Robert Schröder

Robert Schröder

@saits

I'm a self-taught n8n automation specialist from Zürich with 2 years of intensive experience building complex workflows. My focus lies in creating practical, production-ready workflows that solve real business challenges - from AI-powered content generation to data management and process automation. Each workflow I share reflects tested, optimized solutions that deliver measurable results.

外部链接
在 n8n.io 查看

分享此工作流