AutomationFlowsWeb Scraping › Image Generator Workflow

Image Generator Workflow

Image Generator Workflow. Uses executeWorkflowTrigger, httpRequest. Event-driven trigger; 8 nodes.

Event trigger★★★★☆ complexity8 nodesExecute Workflow TriggerHTTP Request
Web Scraping Trigger: Event Nodes: 8 Complexity: ★★★★☆ Added:

This workflow follows the Execute Workflow Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Image Generator Workflow",
  "nodes": [
    {
      "parameters": {},
      "id": "workflow-start",
      "name": "Start",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Calculate number of images needed\nconst data = $input.item.json;\nconst duration = data.estimatedDuration || 60;\nconst imagesPerMinute = data.imagesPerMinute || 3;\nconst numImages = Math.ceil((duration / 60) * imagesPerMinute);\n\nconst apiKey = data.apiKeys?.imageApi || $env.IMAGE_API_KEY;\n\nreturn {\n  apiKey,\n  numImages,\n  script: data.script,\n  topic: data.topic,\n  userId: data.userId,\n  imagePrompts: [] // Will be filled in next node\n};"
      },
      "id": "calculate-images",
      "name": "Calculate Image Count",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Generate image prompts from script\nconst data = $input.item.json;\nconst script = data.script;\nconst numImages = data.numImages;\n\n// Split script into segments\nconst words = script.split(' ');\nconst wordsPerImage = Math.floor(words.length / numImages);\n\nconst prompts = [];\nfor (let i = 0; i < numImages; i++) {\n  const start = i * wordsPerImage;\n  const segment = words.slice(start, start + wordsPerImage).join(' ');\n  \n  // Create visual prompt from text segment\n  const prompt = `Create a professional, high-quality image representing: ${segment.substring(0, 200)}. Style: modern, clean, vibrant colors.`;\n  \n  prompts.push({\n    index: i,\n    prompt: prompt.substring(0, 300) // Limit prompt length\n  });\n}\n\nreturn {\n  apiKey: data.apiKey,\n  imagePrompts: prompts,\n  topic: data.topic,\n  userId: data.userId\n};"
      },
      "id": "create-prompts",
      "name": "Create Image Prompts",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "id": "split-prompts",
      "name": "Split Prompts",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Calculate Image Count').item.json.apiKey }}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "text_prompts",
              "value": "=[{\"text\": \"{{ $json.prompt }}\", \"weight\": 1}]"
            },
            {
              "name": "cfg_scale",
              "value": "7"
            },
            {
              "name": "height",
              "value": "720"
            },
            {
              "name": "width",
              "value": "1280"
            },
            {
              "name": "samples",
              "value": "1"
            }
          ]
        },
        "options": {}
      },
      "id": "generate-image",
      "name": "Generate Image",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1050,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Process generated image\nconst response = $input.item.json;\nconst imageBase64 = response.artifacts[0].base64;\nconst index = $('Split Prompts').item.json.index;\n\nreturn {\n  imageIndex: index,\n  imageBase64: imageBase64,\n  fileName: `image_${index}_${Date.now()}.png`,\n  mimeType: 'image/png'\n};"
      },
      "id": "process-image",
      "name": "Process Image",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ]
    },
    {
      "parameters": {
        "amount": 2,
        "unit": "seconds"
      },
      "id": "rate-limit",
      "name": "Rate Limit Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        1450,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Aggregate all images\nconst allImages = $input.all();\n\nreturn {\n  images: allImages.map(img => ({\n    index: img.json.imageIndex,\n    base64: img.json.imageBase64,\n    fileName: img.json.fileName,\n    mimeType: img.json.mimeType\n  })),\n  topic: $('Calculate Image Count').item.json.topic,\n  userId: $('Calculate Image Count').item.json.userId\n};"
      },
      "id": "aggregate-images",
      "name": "Aggregate Images",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1650,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Calculate Image Count",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Image Count": {
      "main": [
        [
          {
            "node": "Create Image Prompts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Image Prompts": {
      "main": [
        [
          {
            "node": "Split Prompts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Prompts": {
      "main": [
        [
          {
            "node": "Generate Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "Process Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Image": {
      "main": [
        [
          {
            "node": "Rate Limit Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate Limit Wait": {
      "main": [
        [
          {
            "node": "Split Prompts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "updatedAt": "2026-01-25T00:00:00.000Z",
  "versionId": "1"
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Image Generator Workflow. Uses executeWorkflowTrigger, httpRequest. Event-driven trigger; 8 nodes.

Source: https://github.com/Prince364133/snap-Tube-ai/blob/7c5acb3d5c26d67fcecd5bc6a7aeef6870a9f98a/n8n-workflows/image-generator.json — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

02_LLM_Pipeline v1.0. Uses executeWorkflowTrigger, httpRequest, seaTable. Event-driven trigger; 65 nodes.

Execute Workflow Trigger, HTTP Request, Sea Table
Web Scraping

This template is a powerful, reusable utility for managing stateful, long-running processes. It allows a main workflow to be paused indefinitely at "checkpoints" and then be resumed by external, async

HTTP Request, Execute Workflow Trigger
Web Scraping

Upload files from any source to your account Kommo or AmoCRM with a simple and reusable workflow. It can split a large file into small ones and upload chunks. Works for Kommo and amoCRM There are 3 re

HTTP Request, Execute Workflow Trigger, Stop And Error
Web Scraping

Remixed Backup your workflows to GitHub from Solomon's work. Check out his templates.

HTTP Request, GitHub, Execute Workflow Trigger +1
Web Scraping

Remixed Backup your workflows to GitHub from Solomon's work. Check out his templates.

Execute Workflow Trigger, HTTP Request, GitHub