{
  "id": 2738,
  "name": "Transform image to Lego style using line and Dall-E",
  "description": "#### **Who is this for?**\nThis workflow is designed for:\n- **Content creators**, artists, or hobbyists looking to experiment with AI-generated art.\n- **Small business owners** or **marketers** using LEGO-style designs for branding or promotions.\n- **Developers** or **AI enthusiasts** wanting to automate image transformations through messaging platforms like LINE.\n\n---\n\n#### **What problem is this workflow solving?**\n- Simplifies the process of creating custom AI-generated LEGO-style images.\n- Automates the manual effort of transforming user-uploaded images into AI-generated artwork.\n- Bridges the gap between messaging platforms (LINE) and advanced AI tools (DALL\u00b7E).\n- Provides a seamless system for users to upload an image and receive an AI-transformed output without technical expertise.\n\n---\n\n#### **What this workflow does**\n1. **Image Upload via LINE**:\n   - Users send an image to the LINE chatbot.\n2. **AI-Powered Prompt Creation**:\n   - GPT generates a prompt to describe the uploaded image for LEGO-style conversion.\n3. **AI Image Generation**:\n   - DALL\u00b7E 3 processes the prompt and creates a LEGO-style isometric image.\n4. **Image Delivery**:\n   - The generated image is returned to the user in LINE.\n\n---\n\n#### **Setup**\n\n##### **Prerequisites**\n- **LINE Developer Account** with API credentials.\n- Access to **OpenAI API** with DALL\u00b7E and GPT-4 capabilities.\n- A configured **n8n instance** to run this workflow.\n\n##### **Steps**\n1. **Environment Setup**:\n   - Add your LINE API Token and OpenAI credentials as environment variables (`LINE_API_TOKEN`, `OPENAI_API_KEY`) in n8n.\n2. **Configure LINE Webhook**:\n   - Point the LINE webhook to your n8n instance.\n3. **Connect OpenAI**:\n   - Set up OpenAI API credentials in the workflow nodes for GPT-4 and DALL\u00b7E.\n4. **Test Workflow**:\n   - Upload a sample image in LINE and ensure it returns the LEGO-style AI image.\n\n---\n\n#### **How to customize this workflow to your needs**\n- **Localization**:\n  - Modify response messages in LINE to fit your audience's language and tone.\n- **Integration**:\n  - Add nodes to send notifications through other platforms like Slack or email.\n- **Image Style**:\n  - Replace the LEGO-style image prompt with other artistic styles or themes.\n\n---\n\n#### **Advanced Use Cases**\n1. **Art Contests**:\n   - Users upload images and receive AI-enhanced outputs for community voting or branding.\n2. **Marketing Campaigns**:\n   - Quickly generate creative visual content for ads and promotions using customer-submitted photos.\n3. **Education**:\n   - Use the workflow to teach students about AI-generated art and automation through a hands-on approach.\n\n---\n\n#### **Tips for Optimization**\n- **Error Handling**:\n  - Add fallback nodes to handle invalid images or API errors gracefully.\n- **Logging**:\n  - Implement a logging mechanism to track requests and outputs for debugging and analytics.\n- **Scalability**:\n  - Use queue-based systems or cloud scaling to handle large volumes of image requests.\n\n---\n\n#### **Enhancements**\n- Add sticky notes in n8n to provide inline instructions for configuring each node.\n- Create a tutorial video or documentation for first-time users to set up and customize the workflow.\n- Include advanced filters to allow users to select from multiple styles beyond LEGO (e.g., pixel art, watercolor).\n\nThis workflow enables seamless interaction between messaging platforms and advanced AI capabilities, making it highly versatile for various creative and business applications.",
  "categories": [
    {
      "id": 31,
      "name": "Content Creation"
    },
    {
      "id": 51,
      "name": "Multimodal AI"
    }
  ],
  "totalViews": 1943,
  "createdAt": "2025-01-17T03:33:28.196Z",
  "workflow": {
    "meta": {
      "instanceId": "c59c4acfed171bdc864e7c432be610946898c3ee271693e0303565c953d88c1d",
      "templateCredsSetupCompleted": true
    },
    "name": "Transform Image to Lego Style Using Line and Dall-E",
    "tags": [],
    "nodes": [
      {
        "id": "82b62d4e-a263-4232-9bae-4c581db2269c",
        "name": "Receive a Line Webhook",
        "type": "n8n-nodes-base.webhook",
        "position": [
          0,
          0
        ],
        "webhookId": "2a27c148-3977-485f-b197-567c96671023",
        "parameters": {
          "path": "lineimage",
          "options": {},
          "httpMethod": "POST"
        },
        "typeVersion": 2
      },
      {
        "id": "f861c4eb-3d4f-4253-810f-8032602f079b",
        "name": "Receive Line Messages",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          220,
          0
        ],
        "parameters": {
          "url": "=https://api-data.line.me/v2/bot/message/{{ $json.body.events[0].message.id }}/content",
          "options": {},
          "jsonHeaders": "={\n\"Authorization\": \"Bearer YOUR_TOKEN_HERE\",\n\"Content-Type\": \"application/json\"\n}",
          "sendHeaders": true,
          "specifyHeaders": "json"
        },
        "typeVersion": 4.2
      },
      {
        "id": "da3a9188-028d-4c75-b23f-5f1f4e50784c",
        "name": "Creating an Image using Dall-E",
        "type": "@n8n/n8n-nodes-langchain.openAi",
        "position": [
          860,
          0
        ],
        "parameters": {
          "prompt": "={{ $json.content }}",
          "options": {
            "returnImageUrls": true
          },
          "resource": "image"
        },
        "credentials": {
          "openAiApi": {
            "id": "credential-id",
            "name": "openAiApi Credential"
          }
        },
        "typeVersion": 1.7
      },
      {
        "id": "36c826e5-eacd-43ad-b663-4d788005e61a",
        "name": "Creating a Prompt for Dall-E (Lego Style)",
        "type": "@n8n/n8n-nodes-langchain.openAi",
        "position": [
          540,
          0
        ],
        "parameters": {
          "text": "Creating the DALL\u00b7E 3 prompt to transform this kind of image into a isometric LEGO image (Only provide me with a prompt).",
          "modelId": {
            "__rl": true,
            "mode": "list",
            "value": "gpt-4o-mini",
            "cachedResultName": "GPT-4O-MINI"
          },
          "options": {},
          "resource": "image",
          "inputType": "base64",
          "operation": "analyze",
          "binaryPropertyName": "=data"
        },
        "credentials": {
          "openAiApi": {
            "id": "credential-id",
            "name": "openAiApi Credential"
          }
        },
        "typeVersion": 1.7
      },
      {
        "id": "3c19f931-9ca0-4bd7-b4eb-1628d89bbba1",
        "name": "Send Back an Image through Line",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          1160,
          0
        ],
        "parameters": {
          "url": "https://api.line.me/v2/bot/message/reply",
          "method": "POST",
          "options": {},
          "jsonBody": "={\n  \"replyToken\": \"{{ $('Receive a Line Webhook').item.json.body.events[0].replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"image\",\n      \"originalContentUrl\": \"{{ $json.url }}\",\n      \"previewImageUrl\": \"{{ $json.url }}\"\n    }\n  ]\n}",
          "sendBody": true,
          "jsonHeaders": "{\n\"Authorization\": \"Bearer YOUR_TOKEN_HERE\",\n\"Content-Type\": \"application/json\"\n}",
          "sendHeaders": true,
          "specifyBody": "json",
          "specifyHeaders": "json"
        },
        "typeVersion": 4.2
      }
    ],
    "active": false,
    "pinData": {},
    "settings": {
      "executionOrder": "v1"
    },
    "versionId": "",
    "connections": {
      "Receive Line Messages": {
        "main": [
          [
            {
              "node": "Creating a Prompt for Dall-E (Lego Style)",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Receive a Line Webhook": {
        "main": [
          [
            {
              "node": "Receive Line Messages",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Creating an Image using Dall-E": {
        "main": [
          [
            {
              "node": "Send Back an Image through Line",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Creating a Prompt for Dall-E (Lego Style)": {
        "main": [
          [
            {
              "node": "Creating an Image using Dall-E",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 5,
    "nodeTypes": {
      "n8n-nodes-base.webhook": {
        "count": 1
      },
      "n8n-nodes-base.httpRequest": {
        "count": 2
      },
      "@n8n/n8n-nodes-langchain.openAi": {
        "count": 2
      }
    }
  },
  "nodes": [
    "Receive a Line Webhook",
    "Receive Line Messages",
    "Creating an Image using Dall-E",
    "Creating a Prompt for Dall-E (Lego Style)",
    "Send Back an Image through Line"
  ],
  "nodeTypes": [
    "n8n-nodes-base.httpRequest",
    "n8n-nodes-base.webhook",
    "@n8n/n8n-nodes-langchain.openAi"
  ]
}