[Agent CircleのN8Nワークフロー] 自動AI画像ジェネレーター

上級

これはContent Creation, Multimodal AI分野の自動化ワークフローで、16個のノードを含みます。主にSet, Code, Telegram, HttpRequest, ReadWriteFileなどのノードを使用。 無料のAI画像ジェネレーター - Gemini/ChatGPTを基にしたn8n自動化ワークフロー

前提条件
  • Telegram Bot Token
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Gemini API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "cmncRJ2rlecEwZxU",
  "meta": {
    "instanceId": "ed6d846a2fce1f660ede2e7da800724cca01dc3d0685524a3c917881b7cfcfe9"
  },
  "name": "[Agent Circle's N8N Workflow] Automated AI Image Creator",
  "tags": [],
  "nodes": [
    {
      "id": "d5d1fe1b-f053-4162-adf4-5b52b409942d",
      "name": "Fields - 値の設定",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4e04fec4-441e-45f7-acea-0017a4b5c104",
              "name": "model",
              "type": "string",
              "value": "flux"
            },
            {
              "id": "aa80cd68-1c82-4032-b1d7-e098856eec38",
              "name": "width",
              "type": "string",
              "value": "1080"
            },
            {
              "id": "da6d305f-aece-49bd-ae02-52df59915c60",
              "name": "height",
              "type": "string",
              "value": "1920"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e108c56f-b7fb-4818-aed5-c55c59b81516",
      "name": "チャットメッセージ受信時",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        20,
        200
      ],
      "webhookId": "5b347b5d-8f35-45b3-a499-de95153088f0",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "7565ff7c-cfe7-4157-953b-74c1e66d659e",
      "name": "Code - Json のクリーニング",
      "type": "n8n-nodes-base.code",
      "position": [
        980,
        100
      ],
      "parameters": {
        "jsCode": "function cleanAndExtractJSON(response) {\n    try {\n        const result = {\n            image_prompt: []\n        };\n\n        const lines = response.split('\\n');\n        let currentPrompt = '';\n\n        for (const line of lines) {\n            if (line.includes('\"prompt\":')) {\n                if (currentPrompt) {\n                    result.image_prompt.push(currentPrompt.trim());\n                }\n                currentPrompt = line.split('\"prompt\":')[1].trim();\n            }\n        }\n\n        if (currentPrompt) {\n            result.image_prompt.push(currentPrompt.trim());\n        }\n\n        return { json: result };\n        \n    } catch (error) {\n        return { \n            json: {\n                image_prompt: []\n            }\n        };\n    }\n}\n\nconst response = $input.first().json.output;\nreturn cleanAndExtractJSON(response);"
      },
      "executeOnce": false,
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "8e33813d-bd34-46b9-91c8-89dac7f28add",
      "name": "Code - プロンプト取得",
      "type": "n8n-nodes-base.code",
      "position": [
        1160,
        100
      ],
      "parameters": {
        "jsCode": "return $input.first().json.image_prompt.map(prompt => ({\n  json: {\n    body: {\n      prompt: prompt,\n  \"image_size\": {\n    \"width\": $('Fields - Set Values').first().json.width,\n    \"height\": $('Fields - Set Values').first().json.height\n  },\n  \"num_inference_steps\": 12,\n  \"guidance_scale\": 3.5,\n  \"num_images\": 1,\n  \"enable_safety_checker\": true,\n}\n    }\n  }\n));"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "fba88baa-70e8-452c-b44e-d1685df0eb7d",
      "name": "HTTP Request - 画像作成",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1600,
        100
      ],
      "parameters": {
        "url": "=https://image.pollinations.ai/prompt/ {{ $('Code - Get Prompt').item.json.body.prompt }}",
        "options": {},
        "jsonQuery": "={\n  \"width\": {{ $('Fields - Set Values').item.json.width }},\n  \"height\": {{ $('Fields - Set Values').item.json.height }},\n  \"model\": \"{{ $('Fields - Set Values').item.json.model }}\",\n  \"seed\": 42,\n  \"nologo\": true\n}",
        "sendQuery": true,
        "sendHeaders": true,
        "specifyQuery": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true,
      "waitBetweenTries": 5000
    },
    {
      "id": "25617f21-8d05-4ca2-9c16-5cd97e369bdb",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "disabled": true,
      "position": [
        20,
        0
      ],
      "webhookId": "ff17baeb-3182-41c4-b60a-e6159b02023b",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "de666684-e743-40ef-b604-1cff33b107de",
      "name": "Code - ファイル名設定",
      "type": "n8n-nodes-base.code",
      "position": [
        1320,
        100
      ],
      "parameters": {
        "jsCode": "for (let i = 0; i < items.length; i++) {\n  items[i].json.fileName = `images_${(i + 1).toString().padStart(3, '0')}.png`;\n}\nreturn items;"
      },
      "typeVersion": 2
    },
    {
      "id": "e04c2a46-a670-4042-88d1-79207731c864",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        540,
        300
      ],
      "parameters": {
        "options": {
          "topK": 40,
          "topP": 1,
          "temperature": 0.5,
          "safetySettings": {
            "values": [
              {
                "category": "HARM_CATEGORY_HARASSMENT",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_HATE_SPEECH",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                "threshold": "BLOCK_NONE"
              }
            ]
          },
          "maxOutputTokens": 65536
        },
        "modelName": "models/gemini-2.0-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "AlDwotqhFT4EfJXQ",
          "name": "Google Gemini(PaLM) Api - toan.ngo"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d2d0e95d-797e-473c-a70f-d8c4cccd32af",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -760
      ],
      "parameters": {
        "width": 520,
        "height": 1480,
        "content": "## [Agent Circle's N8N Workflow] Automated AI Image Creator - Try It Out!\n\n**This n8n template demonstrates how to use AI to generate custom images from scratch - fully automated, prompt-driven, and ready to deploy at scale.**\n\nUse cases are many: You can use it for marketing visuals, character art, digital posters, storyboards, or even daily image generation for your personal purposes.\n\n## How It Works\n- The flow is triggered by a chat message in N8N or via Telegram. The default image size is 1080 x 1920 pixels. To use a different size, update the values in the **“Fields - Set Values”** node before triggering the workflow.\n- The input is parsed into a clean, structured prompt using a multi-step transformation process.\n- Our AI Agent sends the final prompt to Google Gemini’s image model for generation (you can also integrate with OpenAI or other chat models).\n- The raw image data created by the AI Agent will be run through a number of codes to make sure it's feasible for your preview if needed and downloading.\n- Then, we use an HTTP node to fetch the result so you can preview the image.\n- You can send it back to the chat message in N8N or Telegram, or save it locally to your disk.\n\n## How To Use\n- Download the workflow package.\n- Import the package into your N8N interface.\n- Set up the credentials in the following nodes for tool access and usability: **\"Telegram Trigger\"**; **\"AI Agent - Create Image From Prompt\"**; **\"Telegram Response\"** or **\"Save Image To Disk\"** (based on your wish).\n- Activate the **\"Telegram Response\"** OR **\"Save Image To Disk\"** node to specify where you want to save your image later.\n- Open the chat interface (via N8N or Telegram).\n- Type your image prompt or detailed descriptions and send.\n- Wait for the process to run and finish in a few seconds.\n- Check the result in your desired saving location.\n\n## Requirements\n- Google Gemini account with image generation access.\n- Telegram bot access and chat setup (optional).\n- Connection to local storage (optional).\n\n## How To Customize\n- We’re setting the default image size to 1080 x 1920 pixels and the default image model to \"flux\". You can customize both of these values in the **“Fields – Set Values”** node. Supported image model options include: \"flux\", \"kontext\", \"turbo\", and \"gptimage\".\n- In the **“AI Agent – Create Image From Prompt”** node, you can also change the AI chat model. By default, it uses Google Gemini, but you can easily replace it with OpenAI ChatGPT, Microsoft AI Copilot, or any other compatible provider.\n\n## Need Help?\nJoin our community on different platforms for support, inspiration and tips from others.\n\nWebsite: https://www.agentcircle.ai/\nDiscord Global: https://discord.com/invite/jySQ2PNm\nFB Page Global: https://www.facebook.com/agentcircle/\nFB Group Global: https://www.facebook.com/groups/aiagentcircle/\nGumroad: http://agentcircle.gumroad.com/\nX: https://x.com/agent_circle\nYouTube: https://www.youtube.com/@agentcircle\nLinkedIn: https://www.linkedin.com/company/agentcircle"
      },
      "typeVersion": 1
    },
    {
      "id": "cb6fb57a-e3c1-45ff-9b81-4a2152f397fc",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 440,
        "height": 620,
        "content": "## **1. Get The Inputs**\nWe’ll take your image idea from the text you send in the chat, along with any settings like image size or style. This information is parsed and prepared for the image generation step.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "876439a4-dbfe-4394-96d7-8f6c8a63778d",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 620,
        "content": "## **2. Use Google Gemini's Image Model To Generate The Image**\nYour prompt and settings are sent to Google Gemini’s Image Generation Model.\nPrefer a different model? You can easily swap in alternatives like OpenAI ChatGPT or Microsoft Copilot.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ac07f44c-c881-4d80-bd65-a8aa0ce39375",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1540,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 620,
        "content": "## **4. Preview And Save The Image**\nOnce your image is ready in a downloadable format, you’ll be able to preview it. If you're happy with the result, you can save it in one of two ways by activating either of them before running the workflow:\n- As a reply in Telegram chat\n- To your local storage (disk)\n\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "fdd981c2-2659-4a31-b37f-b5c4cd51ee3c",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        940,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 620,
        "content": "## **3. Prepare The Final Image Feasible For Preview And Saving**\nThis stage helps to clean up the raw output from the AI Agent for your image request and format it into a complete, ready-to-view and downloadable format. \n"
      },
      "typeVersion": 1
    },
    {
      "id": "3a150703-2a7f-4255-9da0-6a15c005290c",
      "name": "AI Agent - プロンプトから画像作成",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        540,
        100
      ],
      "parameters": {
        "text": "={{ $('When chat message received').item.json.chatInput }}",
        "options": {
          "systemMessage": "=You are an AI image‑prompt creation expert. Please create a post using the following JSON format:\nAI Image Generation Prompt Guidelines:\nObjective\nCreate highly realistic, high‐quality images\nEnsure the image content faithfully conveys the spirit of the original text\nIntegrate short text (10–20 characters) naturally into the image\nMaintain consistency and professionalism\n\nStandard Prompt Structure\n[Main Scene] | [Key Elements] | [Text Integration] | [Lighting & Atmosphere] | [Technical Parameters] | [Style Parameters]\n\nComponent Breakdown\n1. Main Scene (Weight ::8)\nDescribe the primary setting in line with the content.\nExamples:\nTech news: “modern tech office setting, minimalist workspace”\nEconomy news: “professional financial district, corporate environment”\nEducation news: “modern classroom, advanced learning environment”\n\n2. Key Elements (Weight ::8)\nList the main visual elements required.\nExamples:\n“large HD display showing text ‘AI Ethics’ in modern typography”\n“professional people in business attire discussing around interactive screen”\n“detailed infographic elements floating in augmented reality style”\n\n3. Text Integration (Weight ::7)\nHow to display text within the image:\ntext elements | elegant typography, clear readable text, integrated naturally into scene ::7\n\n4. Lighting & Atmosphere (Weight ::7)\nlighting | cinematic dramatic lighting, natural ambient light, professional studio setup ::7\nbackground | depth of field blur, clean professional environment ::6\n\n5. Technical Parameters\nparameters | 8k resolution, hyperrealistic, photorealistic quality, octane render, cinematic composition --ar 16:9\nsettings | sharp focus, high detail, professional photography --s 1000 --q 2\nComplete Examples\nExample 1: AI Ethics News\nprofessional tech conference room | large display showing \"AI Ethics Now\" in modern typography, group of diverse executives in discussion ::8 | clean modern workspace, glass walls, tech atmosphere ::7 | cinematic lighting, natural window light ::7 | 8k resolution, hyperrealistic quality, octane render --ar 16:9 --s 1000 --q 2\nExample 2: Financial Market News\nmodern stock exchange environment | giant LED wall showing \"Market Alert\" in bold typography, professional traders in action ::8 | dynamic financial data visualization, sleek modern interior ::7 | dramatic lighting, blue-tinted atmosphere ::7 | 8k resolution, photorealistic quality --ar 16:9 --s 1000 --q 2\n\nAdditional Parameters\n--chaos [0–100]: Adjust randomness\n--stylize [0–1000]: Degree of stylization\n--seed [number]: Ensure consistency across generations\n--niji: Optimized for Asian‐style aesthetics\n--v 5.2: Use the latest model version\n\nImportant Notes\nText in Image\nKeep it short and legible\nUse professional fonts\nIntegrate naturally into the scene\n\nComposition\nFollow the rule of thirds\nEnsure a clear focal point\nBalance text and imagery\n\nColor\nMatch a professional tone\nProvide sufficient contrast for readability\nMaintain visual consistency\n\nTechnical Details\nAlways use high resolution (8k)\nEnsure professional lighting\nOptimize for sharpness and detail\n\nCommon Pitfalls to Avoid\nOverly generic prompts\nMissing text‐integration guidance\nFailing to specify composition rules\nOmitting key technical parameters\n\nThe structure is:\n{\n  prompt_image {prompt : \"\" , ...}\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "a3e5fa40-51c1-41fa-83cb-d6d598f1ff49",
      "name": "Telegram Response",
      "type": "n8n-nodes-base.telegram",
      "disabled": true,
      "position": [
        1820,
        0
      ],
      "webhookId": "ca4806ac-202c-4709-92f9-6484397c17c4",
      "parameters": {
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "haaaQCcDSaJAtymy",
          "name": "Telegram account - hoanglt"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f7059ea5-106b-4b73-8cb3-b0e10e1c0c13",
      "name": "画像をディスクに保存",
      "type": "n8n-nodes-base.readWriteFile",
      "disabled": true,
      "position": [
        1820,
        200
      ],
      "parameters": {
        "options": {},
        "fileName": "=/files/{{ $('Code').item.json.fileName }}",
        "operation": "write"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4f99fd43-197e-47dc-8a5a-5a4c85fdebe9",
  "connections": {
    "25617f21-8d05-4ca2-9c16-5cd97e369bdb": {
      "main": [
        [
          {
            "node": "d5d1fe1b-f053-4162-adf4-5b52b409942d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7565ff7c-cfe7-4157-953b-74c1e66d659e": {
      "main": [
        [
          {
            "node": "8e33813d-bd34-46b9-91c8-89dac7f28add",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8e33813d-bd34-46b9-91c8-89dac7f28add": {
      "main": [
        [
          {
            "node": "de666684-e743-40ef-b604-1cff33b107de",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de666684-e743-40ef-b604-1cff33b107de": {
      "main": [
        [
          {
            "node": "fba88baa-70e8-452c-b44e-d1685df0eb7d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d5d1fe1b-f053-4162-adf4-5b52b409942d": {
      "main": [
        [
          {
            "node": "3a150703-2a7f-4255-9da0-6a15c005290c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e04c2a46-a670-4042-88d1-79207731c864": {
      "ai_languageModel": [
        [
          {
            "node": "3a150703-2a7f-4255-9da0-6a15c005290c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "e108c56f-b7fb-4818-aed5-c55c59b81516": {
      "main": [
        [
          {
            "node": "d5d1fe1b-f053-4162-adf4-5b52b409942d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fba88baa-70e8-452c-b44e-d1685df0eb7d": {
      "main": [
        [
          {
            "node": "f7059ea5-106b-4b73-8cb3-b0e10e1c0c13",
            "type": "main",
            "index": 0
          },
          {
            "node": "a3e5fa40-51c1-41fa-83cb-d6d598f1ff49",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3a150703-2a7f-4255-9da0-6a15c005290c": {
      "main": [
        [
          {
            "node": "7565ff7c-cfe7-4157-953b-74c1e66d659e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - コンテンツ作成, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
上級
ノード数16
カテゴリー2
ノードタイプ10
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

作成者
Agent Circle

Agent Circle

@agentcircle

Agent Circle - A growing marketplace of AI agents, workflows, and toolkits — built to help teams automate smarter and scale faster

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34