AutomationFlowsAI & RAG › Redesign T-shirt Mockups to Print-ready Files

Redesign T-shirt Mockups to Print-ready Files

Original n8n title: Redesign T-shirt Mockups to Print-ready Files with Gpt-4 Vision & Imagen 4

ByThong @duythong on n8n.io

🧠 What This Workflow Does

Chat trigger trigger★★★★☆ complexityAI-powered14 nodesAgentOpenAI ChatChat TriggerOpenAIHTTP Request
AI & RAG Trigger: Chat trigger Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #3959 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger 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
{
  "id": "mx9hxNtV34X4yLo4",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Redesign V3",
  "tags": [],
  "nodes": [
    {
      "id": "dc90044d-f5a1-4f75-80c2-d8ae33fe66e3",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -560,
        -160
      ],
      "parameters": {
        "text": "={{ $json.sessionId }}",
        "options": {
          "systemMessage": "You are a creative prompt generation assistant specialized in T-shirt artwork refinement.\nYour job is to analyze an existing T-shirt design user message above and create a new, upgraded version that preserves the original layout, overall structure, and message placement, but enhances its visual style, mood, and artistic quality.\n\n\u2726 Keep all key design elements and text in their original positions \u2014 do not remove or move important words or graphics.\n\u2726 Improve the typography by suggesting more expressive font styling (e.g., handwritten, retro, bold serif, clean sans-serif, brush script), and enhance the lettering arrangement to feel more dynamic, elegant, or visually balanced.\n\u2726 Enhance illustrative elements, texture, and background details to feel more artistic, emotional, or premium \u2014 without overwhelming the message.\n\u2726 Use descriptive, natural language to generate a final prompt that can be used with Midjourney, DALL\u00b7E, or other image-generation AIs.\n\u2726 The new version should feel like a refined and artistic redesign, not a complete concept change.\n\u2726 Invisible background\n\nRule:\n- Output the final design prompt as a single plain-text sentence, without markdown, formatting, or line breaks. Make sure the prompt is concise but expressive, suitable for use inside a JSON payload or passed into an image generation API. All key elements must remain: characters, objects, text styling, and background mood \u2014 but the format should be clean, compact, and system-friendly.\n- Format the output as a single line of plain text, using escaped double quotes (\\\") where needed, suitable for inclusion in a JSON string without formatting issues.\n- If the user chats about a front-facing design, check the memory to make appropriate adjustments."
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "b4a4329a-1687-470b-9531-03ee56ad8c9e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -640,
        80
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fc9db6a3-3890-4f9b-928a-c8dd0f8141fa",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1280,
        -160
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "22756276-04ed-43bd-aa58-9e45a751f218",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -1040,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cb4e9a22-d429-4d11-b536-5d8760dd5042",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $json.chatInput }}",
              "rightValue": "https://"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f39376fd-6310-4576-b07c-38c91f17de8c",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        -260,
        -160
      ],
      "parameters": {
        "jsCode": "const rawContent = $json.output;\n\n// 1. Replace all line breaks with spaces\nlet cleaned = rawContent.replace(/\\n/g, ' ');\n\n// 2. Trim any extra spaces at the beginning and end\ncleaned = cleaned.trim();\n\n// 3. Escape backslashes and double quotes for JSON safety\nlet escaped = cleaned.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n\n// 4. Remove leading or trailing escaped quotes if accidentally included\nescaped = escaped.replace(/^\\\\\\\"/, '').replace(/\\\\\\\"$/, '');\n\n// 5. Return the cleaned and fully escaped string\nreturn [\n  {\n    json: {\n      escapedString: escaped\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "b5d6638a-683a-41c9-a2a2-349b7390d2da",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1380,
        -260
      ],
      "parameters": {
        "width": 280,
        "height": 260,
        "content": "## Send a mockup image url to chat"
      },
      "typeVersion": 1
    },
    {
      "id": "3c81f3be-d7f8-4874-a48b-29b9b8da1496",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -260
      ],
      "parameters": {
        "color": 5,
        "width": 200,
        "height": 260,
        "content": "## Analyze image and generate new prompt"
      },
      "typeVersion": 1
    },
    {
      "id": "361d4c52-3edc-464d-af89-4013dd4b95f0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -260
      ],
      "parameters": {
        "color": 3,
        "width": 440,
        "height": 260,
        "content": "## Generate the new Tshirt design by GPT Image 1"
      },
      "typeVersion": 1
    },
    {
      "id": "8fa31818-fb07-4571-8ec6-c740041c3a82",
      "name": "OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        60,
        -160
      ],
      "parameters": {
        "model": "gpt-image-1",
        "prompt": "={{ $json.escapedString }}",
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "2f5b907e-d979-4db1-954a-bb87af09dafd",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        -260
      ],
      "parameters": {
        "width": 460,
        "height": 260,
        "content": "## Prompt Generation"
      },
      "typeVersion": 1
    },
    {
      "id": "1ffe82c1-fb36-4776-bdc4-775571deb303",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        60
      ],
      "parameters": {
        "width": 440,
        "height": 240,
        "content": "## Generate the new Tshirt design by Gemini Imagen 4"
      },
      "typeVersion": 1
    },
    {
      "id": "32c939e3-e05b-4e5a-becb-a0fde7f9588f",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "notes": "D\u00f9ng cho \u1ea3nh n\u1ed5i b\u1eadt",
      "position": [
        180,
        140
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "predictions[0].bytesBase64Encoded"
      },
      "typeVersion": 1.1
    },
    {
      "id": "8d0d5db5-2762-4751-9580-5df640d12e4c",
      "name": "Gemini Generate Image",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "D\u00f9ng cho \u1ea3nh n\u1ed5i b\u1eadt",
      "position": [
        -40,
        140
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/imagen-4.0-generate-preview-06-06:predict",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"instances\": [\n    {\n      \"prompt\": \"{{ $json.escapedString }}\"\n    }\n  ],\n  \"parameters\": {\n    \"sampleCount\": 1,\n    \"aspectRatio\": \"3:4\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth"
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2e2f4744-5cd0-48ca-a547-26f6b48563c0",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -840,
        -140
      ],
      "parameters": {
        "text": "=What's in this image? ",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "GPT-4O"
        },
        "options": {},
        "resource": "image",
        "imageUrls": "={{ $json.chatInput }}",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ff93bacc-edc7-4baf-9207-1c2c0256f873",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Gemini Generate Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Generate Image": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

🧠 What This Workflow Does

Source: https://n8n.io/workflows/3959/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

Who’s it for Creators who want to create faceless videos automatically, while keeping human oversight and quality control.

Read Write File, Agent, OpenAI Chat +7
AI & RAG

The Best Linkedin Posting System. Uses httpRequest, lmChatOpenAi, agent, chatTrigger. Chat trigger; 49 nodes.

HTTP Request, OpenAI Chat, Agent +8
AI & RAG

Who is this workflow for? This workflow is designed for SEO analysts, content creators, marketing agencies, and developers who need to index a website and then interact with its content as if it were

Agent, OpenAI Chat, Memory Buffer Window +10
AI & RAG

Categories: AI Agents, Design Automation, Business Tools

Tool Workflow, HTTP Request Tool, Memory Buffer Window +7
AI & RAG

Extract Insights & Analyse Youtube Comments Via Ai Agent Chat. Uses stickyNote, lmChatOpenAi, toolWorkflow, memoryPostgresChat. Chat trigger; 29 nodes.

OpenAI Chat, Tool Workflow, Memory Postgres Chat +5