n8n-AI自动化:一键批量生成爆款海报,效率提升100倍!

1- 一键批量生成爆款海报

本期视频笔记:

  1. 如何开通 ChatGPT Plus 会员及申请 OpenAI API:
    1. https://www.youtube.com/watch?v=xRb0dB7fZEs
  2. 海报生成器工作流配置文件:
    1. https://file.linbintalk.com/n8nposter.json
  3. 《AI 自动化大师课:从零构建企业级工作流》:
    1. https://ailinplus-s-school.teachable.com/p/ai

[!note]
海报生成器工作流配置文件


{
  "name": "海报生成器",
  "nodes": [
    {
      "parameters": {
        "formTitle": "海报生成器",
        "formDescription": "输入文案内容、自动生成海报",
        "formFields": {
          "values": [
            {
              "fieldLabel": "主标题",
              "requiredField": true
            },
            {
              "fieldLabel": "副标题",
              "requiredField": true
            },
            {
              "fieldLabel": "辅助信息"
            },
            {
              "fieldLabel": "海报风格",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "手写风格"
                  },
                  {
                    "option": "3D风格"
                  },
                  {
                    "option": "极简风格"
                  },
                  {
                    "option": "赛博朋克风格"
                  },
                  {
                    "option": "复古风格"
                  },
                  {
                    "option": "霓虹风格"
                  },
                  {
                    "option": "扁平风格"
                  },
                  {
                    "option": "涂鸦风格"
                  },
                  {
                    "option": "书法风格"
                  },
                  {
                    "option": "像素风格"
                  },
                  {
                    "option": "自然风格"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -800,
        880
      ],
      "id": "29c7d9e1-113e-47b5-a2e1-7f68a01bccdd",
      "name": "On form submission",
      "webhookId": "06b2d123-4a87-4e0c-aea0-8bfa787adef2"
    },
    {
      "parameters": {
        "resource": "image",
        "model": "gpt-image-1",
        "prompt": "={{ $json.text }}",
        "options": {
          "quality": "high",
          "size": "1024x1536"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        460,
        880
      ],
      "id": "69a7c1a6-69a9-4780-9c3e-e252b8eda8b8",
      "name": "OpenAI",
      "credentials": {
        "openAiApi": {
          "id": "XwaDmaW2nHopWGJX",
          "name": "APIHUB"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=主标题:{{ $('On form submission').item.json['主标题'] }}\n副标题:{{ $('On form submission').item.json['副标题'] }}\n辅助信息:{{ $('On form submission').item.json['辅助信息'] }}\n风格要求: {{ $json.data[0].Prompt }}",
        "messages": {
          "messageValues": [
            {
              "message": "# Role\n你是一个文案视觉转化助手,专注于将结构化的文案(主标题、副标题、辅助信息)转化为适合生成海报图像的中文Prompt。\n\n## Skills\n### Skill 1: 整合文案内容\n- 将用户提供的文案内容(包括:主标题、副标题、辅助信息)整合成一段完整的图像场景描述。\n- 确保风格连贯、自然,具备画面感。\n- 可适当补充背景、构图、氛围、人物或道具细节,以增强视觉效果。\n\n### Skill 2: 保持核心信息\n- 保持文案的核心信息不变,同时优化语言节奏与情绪表达,使其更具吸引力与视觉指导性。\n- 输出为一段自然流畅的描述,不分行、不列点、不重复原文。\n\n### Skill 3: 其他要求\n- 如信息中含有风格、色调、构图等要求,应将其融合进整体语句中体现出来,确保每个细节都在最终的图像场景描述中得以体现。"
            }
          ]
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.6,
      "position": [
        80,
        880
      ],
      "id": "6830e5a1-6c6c-41ae-89df-aeb01d4c140c",
      "name": "Basic LLM Chain"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "typeVersion": 1,
      "position": [
        168,
        1100
      ],
      "id": "180b4fd3-5d68-4741-b64c-e087ee7a2eee",
      "name": "DeepSeek Chat Model",
      "credentials": {
        "deepSeekApi": {
          "id": "peOp7pcjSxphhmmF",
          "name": "DeepSeek account"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "3D风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "b98714f9-8e5d-4330-be71-6c02984f1e8d"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "93a8ca57-f93e-4d93-9056-ab0f61e8f2cf",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "手写风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "463f0f87-8190-4320-ae5b-0c28971ef1cb",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "极简风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "affccdb4-65ea-4eb0-8c35-6ccb1edf2a59",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "赛博朋克风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "0cfbdd8a-9a5c-442c-be19-76e81da2ba51",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "复古风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "47f69a08-4fa1-4420-bdb2-04febb894f6a",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "霓虹风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "23f83f39-da5b-46b1-a434-11e0c1bfffc0",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "扁平风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "7bfd938d-900d-494e-b04c-ba547c7cd553",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "涂鸦风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "a31c8888-cc7d-4586-b750-2e0ee1b2aa80",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "自然风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "cc1c37f2-3981-4623-b42a-679cfe8d25ed",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "像素风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "249b68ac-72dd-4ed7-a880-3844bc2bd166",
                    "leftValue": "={{ $json['海报风格'] }}",
                    "rightValue": "书法风格",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -580,
        712
      ],
      "id": "d800c1d1-dde0-424d-aefc-0e2a3dbf17c6",
      "name": "Switch1"
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        -140,
        880
      ],
      "id": "257b7daa-aed1-485e-98bb-231f80513f3b",
      "name": "Aggregate1"
    },
    {
      "parameters": {
        "operation": "write",
        "fileName": "=./n8ndata/ {{ $('On form submission').item.json[\"主标题\"] }}-{{ $('On form submission').item.json[\"海报风格\"] }}.png",
        "options": {
          "append": false
        }
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        676,
        880
      ],
      "id": "2b1f085e-9607-462b-83f5-6ef6f74f6ed6",
      "name": "Read/Write Files from Disk"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b00580d7-7b2b-4fea-9cc2-3b02c4170a45",
              "name": "Prompt",
              "value": "3D text, realistic lighting, isometric perspective, metallic and glossy texture, shadows and reflections",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        -120
      ],
      "id": "d9a51ca2-20ea-485d-8c2c-45b3b17cda2c",
      "name": "3D风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "hand-drawn lettering, sketch style, pastel colors, pencil texture, childlike, artistic",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        80
      ],
      "id": "b3b35895-3f8a-4c96-a5ac-ea7816cdb9d6",
      "name": "手写风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "minimalist text poster, clean typography, monochrome, white background, elegant, modern layout",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        280
      ],
      "id": "2418c39f-3584-4a87-8f23-2b0f58366826",
      "name": "极简风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "cyberpunk style, neon text, futuristic city background, glowing letters, high contrast, purple and blue",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        680
      ],
      "id": "a9d74d68-5594-434d-a7d9-7e80ee339143",
      "name": "赛博朋克风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "vintage poster, retro text, old paper texture, grainy, warm faded tones, classic design",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        1080
      ],
      "id": "67a9740e-de68-46c6-adfe-e484e7c66f89",
      "name": "复古风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "neon text, dark background, glowing outline, electric colors, light tubes effect",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        1480
      ],
      "id": "807df099-464f-4f2e-bf28-fea7cd3189b8",
      "name": "霓虹风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "flat design poster, bold solid colors, simple shapes, clean typography, modern look",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        1880
      ],
      "id": "c34f9179-c7a2-4662-a836-442c6982a179",
      "name": "扁平风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "graffiti text, urban wall background, spray paint texture, street art style, bold and wild",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        480
      ],
      "id": "a3dacad1-d957-4c6f-83b5-74379f5836df",
      "name": "涂鸦风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "organic nature-themed text, leaves and flowers integrated, wooden texture, eco-friendly colors",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        880
      ],
      "id": "44ed0ead-4553-4294-85a1-80c4a0903fab",
      "name": "自然风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "pixel art text, 8-bit style, retro game UI, colorful blocky letters, old computer feel",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        1280
      ],
      "id": "775db08b-73dd-4af8-84a6-5be9e598a68c",
      "name": "像素风格"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "880c0666-86e2-492c-8f5a-b2cfedb44e35",
              "name": "Prompt",
              "value": "chinese calligraphy, ink brush style, elegant strokes, paper texture background, traditional art",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -360,
        1680
      ],
      "id": "827292d7-29d2-49bf-b9ff-c4c5be37c102",
      "name": "书法风格"
    }
  ],
  "pinData": {},
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "3D风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "手写风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "极简风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "赛博朋克风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "复古风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "霓虹风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "扁平风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "涂鸦风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "自然风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "像素风格",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "书法风格",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate1": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3D风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "手写风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "极简风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "赛博朋克风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "复古风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "霓虹风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "扁平风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "涂鸦风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "自然风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "像素风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "书法风格": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f39cdb7c-0373-4487-985d-5212dfccabed",
  "meta": {
    "template