N
n8n Store
Workflow Market
Image to Image Generation

Image to Image Generation

by nasser0 views

描述

分类

🤖 AI & Machine Learning

使用的节点

n8n-nodes-base.setn8n-nodes-base.waitn8n-nodes-base.airtablen8n-nodes-base.airtablen8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNote
价格免费
浏览量0
最后更新11/28/2025
workflow.json
{
  "id": "",
  "meta": {
    "instanceId": "",
    "templateCredsSetupCompleted": true
  },
  "name": "Image to Image Generation",
  "tags": [],
  "nodes": [
    {
      "id": "",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -680,
        -180
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -380,
        -180
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://airtable.com/",
          "cachedResultName": "YTB Outlier Finder"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://airtable.com/",
          "cachedResultName": "Image Generation"
        },
        "options": {
          "fields": [
            "ImageDescription",
            "Situation",
            "BaseImage",
            "Name"
          ]
        },
        "operation": "search",
        "filterByFormula": "={Prompt} = \"\""
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "",
      "name": "Generate Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        140,
        -180
      ],
      "parameters": {
        "url": "https://fal.run/fal-ai/flux-pro/kontext/max",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "={{ $json.text }}"
            },
            {
              "name": "image_url",
              "value": "={{ $('Airtable').item.json.BaseImage[0].url }}"
            },
            {
              "name": "guidance_scale",
              "value": "7.5"
            },
            {
              "name": "num_images",
              "value": 1
            },
            {
              "name": "safety_tolerance",
              "value": 2
            },
            {
              "name": "output_format",
              "value": "jpeg"
            },
            {
              "name": "sync_mode",
              "value": "false"
            },
            {
              "name": "aspect_ratio",
              "value": "1:1"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Key {{ $('Edit Fields').item.json.FalAITOKEN }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "",
      "name": "Log Image Posts",
      "type": "n8n-nodes-base.airtable",
      "position": [
        640,
        -200
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://airtable.com/",
          "cachedResultName": "YTB Outlier Finder"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://airtable.com/",
          "cachedResultName": "Table 2"
        },
        "columns": {
          "value": {
            "Name": "={{ $('Airtable').item.json.Name }}",
            "Prompt": "={{ $json.prompt }}",
            "FinalImage": "={{ [{ \"url\": $json.images[0].url}] }}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "BaseImage",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "BaseImage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ImageDescription",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "ImageDescription",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Situation",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Situation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Prompt",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Prompt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "FinalImage",
              "type": "array",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "FinalImage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "",
      "name": "Check IF Generated",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        340,
        -180
      ],
      "parameters": {
        "url": "={{ $json.images[0].url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        500,
        -120
      ],
      "webhookId": "",
      "parameters": {
        "amount": 3
      },
      "typeVersion": 1.1
    },
    {
      "id": "",
      "name": "Mistral Cloud Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        -140,
        -20
      ],
      "parameters": {
        "model": "mistral-large-latest",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "id": "",
          "name": "Mistral Cloud account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Generate Prompt",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -220,
        -180
      ],
      "parameters": {
        "text": "You are a Image Generation assistant.",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "type": "HumanMessagePromptTemplate",
              "message": "=You are a creative prompt engineer specializing in generating detailed image-to-image prompts for AI models like Stable Diffusion or Leonardo AI.\n\nYou will receive:\n- A base subject :{{ $json.ImageDescription }}\n- A situation or context that must be represented visually :{{ $json.Situation }}\n\nYour task is to generate an enhanced, imaginative prompt that:\n- Incorporates the visual details from the situation.\n- Respects the base subject’s identity (i.e., the AI will transform an image of the given subject, not create a completely new one).\n- Uses scene-building language to describe environment, mood, lighting, and dynamics.\n- Mentions the style if relevant (e.g., “realistic”, “cinematic”, “fantasy illustration”, etc.).\n- Avoids over-describing the subject's core features (to preserve the base image).\n\nOutput Format:\n- One paragraph of 1–3 sentences.\n- Include keywords or phrases that guide the AI visually (e.g., “dramatic lighting”, “smoke and lava in the background”, “third-person perspective”).\n- Return ONLY the prompt that will be directly given to the Image Generation LLM.\n\nExample Input:\nSubject: “a dog”\nSituation: “the dog is climbing a volcano in eruption”\n\nExample Output Prompt:\n“A dog braving the treacherous slopes of an erupting volcano, surrounded by glowing lava streams and thick clouds of smoke. The sky is darkened with ash as fiery embers illuminate the scene. Realistic style, cinematic lighting, wide-angle perspective.”"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -280
      ],
      "parameters": {
        "color": 7,
        "width": 760,
        "height": 400,
        "content": "## Image Generation"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -280
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 400,
        "content": "## Base Image & Prompt"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -700
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 400,
        "content": "## SETUP\n\n**Setup Input :** The first part of the workflow can be replaced with anything else. You need as input a Prompt and the Base Image URL (publicly available).\n\n**Setup Output :** In this Workflow, the output is storing the image on Airtable but you can replace that with anything else but basically you have two options : \n- Store the Generated Image somewhere : Keep everything like this and replace the last Airtable node with the Third Party you want to use.\n- Use the Image directly in n8n : In HTTP Request \"Generate Image\" switch sync_mode to \"true\", remove all the following nodes and add \"Extract form File\" node (convert to Base64 String)\n\n\n**APIs :** For the following third-party integrations, replace [YOUR_API_TOKEN] with your API Token or connect your account via Client ID / Secret to your n8n instance:\n- Fal AI (FLUX KONTEXT MAX) : https://fal.ai/models/fal-ai/flux-pro/kontext/max/api#schema-input\n- Airtable : https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.airtable/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.airtable"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -1200
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 480,
        "content": "## How it works?\n**1 -** Retrieve Base Image, Image Description and Situation from Airtable\n**2 -** Generate Image Prompt\n**3 -** Generate Image via Fal AI\n**4 -** Verify if Image is generated\n**5 -** Upload Image on Airtable\n\n**📺 Youtube Video Tutorial :**\n[![Watch on YouTube](https://img.youtube.com/vi/0SVj70-dA0Q/maxresdefault.jpg)](https://www.youtube.com/watch?v=0SVj70-dA0Q)"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -920
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 620,
        "content": "## Base Image\n![Base Image](https://res.cloudinary.com/dhvhddcz5/image/upload/v1751021415/YFBULl-W-39oeY1zbJqzuMfL55NHbz6IOlVF8b2BjO8_kw0tjr.jpg)\n\n**Prompt** : A tower standing tall in the heart of a lush jungle, with vibrant greenery and exotic flowers at its base. Sunlight filters through the dense canopy above, casting dappled shadows on the tower's surface. The air is thick with humidity, and the sounds of wildlife echo through the cinematic scene, realistic style, with a low-angle perspective looking up at the tower.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -720
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 420,
        "content": "## Generated Image\n![Generated Image](https://res.cloudinary.com/dhvhddcz5/image/upload/v1751021411/yP2qhPt15mZAb3lakteeok2F6_0_XgxzaHfXbj848FE_slelrp.jpg)\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -520,
        -180
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "",
              "name": "FalAITOKEN",
              "type": "string",
              "value": "[YOUR_API_TOKEN]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Check IF Generated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "Generate Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "Check IF Generated",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Generate Prompt": {
      "main": [
        [
          {
            "node": "Generate Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check IF Generated": {
      "main": [
        [
          {
            "node": "Log Image Posts",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Prompt",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流