壁纸
中级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 If, Code, Limit, GoogleDrive, GoogleSheets 等节点。 使用 Gemini 2.0、Google Sheets 和 Drive 从文本提示生成 AI 图像
前置要求
- •Google Drive API 凭证
- •Google Sheets API 凭证
- •Google Gemini API Key
使用的节点 (12)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "5suJRi1g4vivDYic",
"meta": {
"instanceId": "aa8f1cf0c4d8087e25a2eea962da249799481d2fb992314793977a97a5e71d77",
"templateCredsSetupCompleted": true
},
"name": "壁纸",
"tags": [],
"nodes": [
{
"id": "28c657d9-88cf-4d96-9e23-d19fe2b49df0",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
-496,
64
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bc74b0c2-aa46-4bcd-91f3-1eb6b0720167",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "pending"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "3d105ba1-85a2-49ea-8311-e15f8133b9be",
"name": "限制",
"type": "n8n-nodes-base.limit",
"position": [
-256,
48
],
"parameters": {},
"typeVersion": 1
},
{
"id": "fa68f0d5-f010-44d6-86e8-f2854ab1b303",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-864,
240
],
"parameters": {
"text": "=You are an expert AI prompt writer specializing in creating vivid, photorealistic image generation prompts. You will be given a simple title and your task is to create a detailed, artistic prompt for an image of nail polish on a woman's hand based on that title.\n\nYour generated prompt should:\n1. Describe a specific nail color, shape, and finish (e.g., glossy, matte, chrome).\n2. Include details about a natural, realistic hand pose and its interaction with an object or environment.\n3. Specify the lighting conditions (e.g., golden hour, studio light, moody).\n4. Set a clear mood or atmosphere.\n5. Conclude with 'Aspect Ratio: 9:16'.\n\n\nImportant formatting requirements for your final output:\n- The entire response must be a single JSON object.\n- The JSON object must have a 'title' key (which should be the original input title you were given) and a 'post' key (which contains your detailed generated prompt).\n- Ensure the text in the JSON values is properly escaped.\n- Do not use double quotes ('') inside the JSON string values; use single quotes (') instead if needed.\n- Do not use asterisks.\n\n\nNow, create a detailed prompt based on the following title:\n{{ $json['Input Title'] }}\n\n\nRespond only with a JSON object in exactly this format:\n{\n \"title\": \"{{ $json.prompt }}\",\n \"post\": \"<your detailed and artistic nail polish prompt here>\"\n}",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.8
},
{
"id": "3a4edc62-a971-4126-b8fe-c3b805a64d97",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
-528,
240
],
"parameters": {
"jsCode": "const items = $input.all();\nconst updatedItems = items.map((item) => {\n if (\n item.json &&\n item.json.output &&\n typeof item.json.output.post === \"string\"\n ) {\n item.json.output.post = item.json.output.post.replace(/\\n/g, \"\\\\n\");\n }\n return item;\n});\nreturn updatedItems;"
},
"typeVersion": 2
},
{
"id": "ca640967-06a4-4c32-ba92-eeaddbea2d67",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-736,
416
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"post\": { \"type\": \"string\" }\n },\n \"required\": [\"title\",\"post\"],\n \"additionalProperties\": false\n}\n"
},
"typeVersion": 1.3
},
{
"id": "45ed5193-a16d-41f4-a9ed-82a5abc23d59",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-880,
416
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "gfe4ixwgGvXB6ixs",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "40c4b1e5-751e-4925-a1d2-2d2a7b419b4c",
"name": "使用 Gemini 生成图片",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
-336,
240
],
"parameters": {
"prompt": "=Create a high-quality, visually engaging image for a social media post based on the following text:\n\n\"{{ $json.output.post }}\"\n",
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.0-flash-exp-image-generation",
"cachedResultName": "models/gemini-2.0-flash-exp-image-generation"
},
"options": {},
"resource": "image"
},
"credentials": {
"googlePalmApi": {
"id": "gfe4ixwgGvXB6ixs",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "85c18e43-16fb-4025-94ad-6dd103876944",
"name": "上传文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-560,
480
],
"parameters": {
"name": "=w_{{ $('Get row(s) in sheet').item.json.ID }}.{{$binary.data.fileExtension || 'png'}}\n",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "16w6uMS_eMimiMCP1L2tQniPxhGwSeTcO",
"cachedResultUrl": "https://drive.google.com/drive/folders/16w6uMS_eMimiMCP1L2tQniPxhGwSeTcO",
"cachedResultName": "wallpaper images"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "1Bnhm02w1dxE4FO6",
"name": "Farooq Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "d5302b59-ccb0-41bf-9fde-bfe82ff2d487",
"name": "分享文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
-416,
480
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "share",
"permissionsUi": {
"permissionsValues": {
"role": "reader",
"type": "anyone"
}
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "1Bnhm02w1dxE4FO6",
"name": "Farooq Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "6fdedb20-c1b0-45d0-ac05-5c80ec58f3ad",
"name": "更新图片URL",
"type": "n8n-nodes-base.googleSheets",
"position": [
-272,
480
],
"parameters": {
"columns": {
"value": {
"ID": "={{ $('If').item.json.ID }}",
"status": "posted",
"imageUrl": "={{$node[\"Upload file\"].json.webViewLink}}"
},
"schema": [
{
"id": "ID",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ID",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "prompt",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "prompt",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "imageUrl",
"type": "string",
"display": true,
"required": false,
"displayName": "imageUrl",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"ID"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UK0t4Fi55oSpdR3DzeGT_YHI1PFFghFj9R4kBfJNh9g/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1UK0t4Fi55oSpdR3DzeGT_YHI1PFFghFj9R4kBfJNh9g",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UK0t4Fi55oSpdR3DzeGT_YHI1PFFghFj9R4kBfJNh9g/edit?usp=drivesdk",
"cachedResultName": "n8n wallpaper"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "bAnK8T185A3Wr7Kj",
"name": "Google Sheets account"
}
},
"typeVersion": 4.7
},
{
"id": "5fdd565d-6d08-4b20-9834-dd0f53f11839",
"name": "计划触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-896,
64
],
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 1
}
]
}
},
"typeVersion": 1.2
},
{
"id": "fd709bf4-02ce-4423-9222-81d0eaff3dba",
"name": "获取表格中的行",
"type": "n8n-nodes-base.googleSheets",
"position": [
-704,
64
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UK0t4Fi55oSpdR3DzeGT_YHI1PFFghFj9R4kBfJNh9g/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1UK0t4Fi55oSpdR3DzeGT_YHI1PFFghFj9R4kBfJNh9g",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UK0t4Fi55oSpdR3DzeGT_YHI1PFFghFj9R4kBfJNh9g/edit?usp=drivesdk",
"cachedResultName": "n8n wallpaper"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "bAnK8T185A3Wr7Kj",
"name": "Google Sheets account"
}
},
"typeVersion": 4.7
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "e5d68149-7913-426e-83c4-23b7c32a2d22",
"connections": {
"If": {
"main": [
[
{
"node": "Limit",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Generate Image with Gemini",
"type": "main",
"index": 0
}
]
]
},
"Limit": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Share file": {
"main": [
[
{
"node": "update imageUrl",
"type": "main",
"index": 0
}
]
]
},
"Upload file": {
"main": [
[
{
"node": "Share file",
"type": "main",
"index": 0
}
]
]
},
"update imageUrl": {
"main": [
[]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Generate Image with Gemini": {
"main": [
[
{
"node": "Upload file",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用Gemini AI创建情感故事:生成图片和Veo3 JSON提示
使用Gemini AI创建情感故事:生成图片和Veo3 JSON提示
If
Set
Code
+12
35 节点Muhammad Farooq Iqbal
内容创作
LinkedIn带图帖子
使用Gemini AI自动生成LinkedIn内容:帖子和图片24/7
If
Code
Limit
+8
17 节点Muhammad Farooq Iqbal
社交媒体
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
内容创作
AI 电影短片生成器
使用 Gemini、GPT 和 ElevenLabs 将名言转换为社交媒体热门视频
If
Jwt
Set
+17
48 节点LukaszB
内容创作
Apollo 数据抓取与触达流程 1 ✅
使用 Apollo、AI 解析和定时邮件跟进自动生成潜在客户
If
Code
Wait
+13
39 节点Deniz
内容创作
内容聚合
使用Gemini AI从网站文章自动化社交媒体帖子发布到LinkedIn和X/Twitter
If
Set
Xml
+16
34 节点Vadim
内容创作