普通の画像を驚くほど美しい写真や動画に変換

上級

これはDesign, AI, Marketing分野の自動化ワークフローで、20個のノードを含みます。主にWait, Telegram, HttpRequest, ConvertToFile, TelegramTriggerなどのノードを使用、AI技術を活用したスマート自動化を実現。 通常の画像を驚くほどの写真や動画に変換する

前提条件
  • Telegram Bot Token
  • ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "e5aa7986ab694604988fd614f16d3dd8cb275c306d75d6a818e14c909713473c"
  },
  "nodes": [
    {
      "id": "0db7b2f0-dfb2-4c92-98c8-d5eb27ca54f3",
      "name": "Telegram Bot Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -280,
        380
      ],
      "webhookId": "ab3c5adb-2300-4fcc-9d5c-7402e7456415",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "download": true
        }
      },
      "description": "Listens for incoming messages with images from a Telegram bot",
      "typeVersion": 1.2
    },
    {
      "id": "434d739e-54d7-4f75-955f-e1181ff23db8",
      "name": "ワークフロー開始ドキュメント",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -20
      ],
      "parameters": {
        "width": 400,
        "height": 560,
        "content": "## 📱 Telegram Message Trigger\n\nThis workflow begins when your Telegram bot receives a message containing an image. The bot waits for users to send a photo with a caption that describes desired edits.\n\n### Requirements:\n- A configured Telegram bot token\n- Images must be sent with a descriptive caption\n- The bot must have permission to download files\n\n### Output:\n- Complete message object with photo data\n- Caption text (used as prompt for AI editing)"
      },
      "typeVersion": 1
    },
    {
      "id": "dc5ddb08-76b8-4a1f-a2fb-315c64199157",
      "name": "ワークフロー概要",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -220
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 560,
        "content": "## 🖼️ Image Processing Pipeline\n\nThis workflow demonstrates a complete AI image processing pipeline:\n\n1. Receives images via Telegram\n2. Edits them with OpenAI's image editing API\n3. Sends the edited result back to user\n4. Optionally generates variations with Replicate\n\n### Use Cases:\n- Product mockups\n- Creative photo editing\n- AI-assisted design iterations\n- Custom image transformations"
      },
      "typeVersion": 1
    },
    {
      "id": "b4682f5b-4c6e-4ba0-a40b-c2851c64bfef",
      "name": "OpenAI API Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        -240
      ],
      "parameters": {
        "color": 3,
        "width": 340,
        "height": 680,
        "content": "## 🎨 OpenAI Image Editing API\n\nSends the image to OpenAI with the caption as a prompt for AI-based editing.\n\n### Configuration:\n- Model: `gpt-image-1`\n- Format: `multipart/form-data`\n- Quality: Low (faster, cheaper)\n- Size: 1024x1024 (standard)\n\n### Input Parameters:\n- `image`: Binary file from Telegram\n- `prompt`: Caption from user message\n- Optional parameters: quality, size, n (number of variations)\n\n### Authentication:\n- Requires OpenAI API key configured in n8n credentials"
      },
      "typeVersion": 1
    },
    {
      "id": "a7266711-bee5-40a2-afc2-86affd226abc",
      "name": "変換ドキュメント",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 580,
        "content": "## 📤 File Format Conversion\n\nConverts the base64-encoded image from OpenAI into a proper binary file format for sending back to the user.\n\n### Technical Details:\n- Transforms API response JSON to binary\n- Source: `data[0].b64_json` field\n- Converts to PNG image format\n- Preserves image quality and metadata\n\n### Output:\n- Binary image data ready for transmission\n- MIME type: image/png"
      },
      "typeVersion": 1
    },
    {
      "id": "f651bd6f-dc2f-4d60-b896-2c860ef0673f",
      "name": "画像編集 (OpenAI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160,
        280
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/images/edits",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "image",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            },
            {
              "name": "prompt",
              "value": "={{ $json.message.caption }}"
            },
            {
              "name": "model",
              "value": "gpt-image-1"
            },
            {
              "name": "n",
              "value": "1"
            },
            {
              "name": "size",
              "value": "1024x1024"
            },
            {
              "name": "quality",
              "value": "low"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "10eOcgAxufRENylm",
          "name": "OpenAi account"
        }
      },
      "description": "Sends image to OpenAI for AI-powered editing based on the caption",
      "typeVersion": 4.2
    },
    {
      "id": "8e50ff8a-6c4b-486e-9307-9624fc7ff274",
      "name": "バイナリ画像への変換",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        580,
        280
      ],
      "parameters": {
        "options": {
          "fileName": "edited_image.png",
          "mimeType": "image/png"
        },
        "operation": "toBinary",
        "sourceProperty": "data[0].b64_json"
      },
      "description": "Converts base64 encoded image to binary format for sending",
      "typeVersion": 1.1
    },
    {
      "id": "e8096804-b5a7-4f2f-943b-e4a5db0929fb",
      "name": "編集済み画像の送信",
      "type": "n8n-nodes-base.telegram",
      "position": [
        880,
        740
      ],
      "webhookId": "6d8b80b6-8450-49c9-98dc-0f34e14da588",
      "parameters": {
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "caption": "Here's your edited image! ✨"
        }
      },
      "description": "Sends the edited image back to the user via Telegram",
      "typeVersion": 1.2
    },
    {
      "id": "d33a7637-4046-40a9-90e6-6d8b8fc2f4b6",
      "name": "Replicate Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        120
      ],
      "parameters": {
        "color": 2,
        "width": 400,
        "height": 700,
        "content": "## 🧠 Replicate AI Image Generation\n\nUses Replicate's API to create additional AI-generated variations of the image.\n\n### Technical Details:\n- Model: pixverse/pixverse-v4\n- Uses image URL from Telegram's file storage\n- Applies custom prompt enhancing the original image\n\n### Authentication:\n- Requires Replicate API token\n- Handles asynchronous process with polling\n\n### Input:\n- Original image URL from Telegram\n- Enhanced prompt for creative direction"
      },
      "typeVersion": 1
    },
    {
      "id": "d0894342-ab6a-473c-9ad0-667987801a9f",
      "name": "待機ノードドキュメント",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        180
      ],
      "parameters": {
        "color": 6,
        "width": 280,
        "height": 600,
        "content": "## ⏱️ Polling Mechanism\n\nWaits for Replicate to process the image generation request.\n\n### Configuration:\n- 45 second wait time\n- Allows asynchronous API to complete processing\n- Prevents timeout errors\n\n### Alternative Options:\n- Could be replaced with polling HTTP requests\n- Webhook can be used if supported by the API"
      },
      "typeVersion": 1
    },
    {
      "id": "5f0417a3-7682-481c-b642-c2b45142839e",
      "name": "ファイル取得ドキュメント",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        -40
      ],
      "parameters": {
        "color": 5,
        "width": 340,
        "height": 560,
        "content": "## 📡 File Retrieval System\n\nRetrieves the file path from Telegram's servers to generate a direct URL.\n\n### Technical Details:\n- Uses Telegram Bot API's getFile endpoint\n- Extracts file_id from the received photo\n- Generates a URL that Replicate can access\n\n### Security Note:\n- Bot token is exposed in the URL\n- Consider using environment variables\n- Limited lifetime access to the file"
      },
      "typeVersion": 1
    },
    {
      "id": "906ba4d2-445c-477f-8732-be7e9d828ba0",
      "name": "バリエーション生成 (Replicate)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1620,
        640
      ],
      "parameters": {
        "url": "https://api.replicate.com/v1/models/pixverse/pixverse-v4/predictions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"input\": {\n    \"prompt\": \"{{ $json.message.caption || 'a creative enhancement of this image' }}\",\n    \"quality\": \"720p\",\n    \"image\": \"https://api.telegram.org/file/bot{{$credentials.telegramBot.botToken}}/{{ $json.result.file_path }}\"\n}}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$credentials.replicateApi.apiKey}}"
            }
          ]
        }
      },
      "description": "Sends the original image to Replicate for AI-powered variation",
      "typeVersion": 4.2
    },
    {
      "id": "ab244f36-31e3-4dea-9c8e-e4935335810a",
      "name": "生成画像の取得",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2540,
        840
      ],
      "parameters": {
        "url": "={{ $json.urls.get }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$credentials.replicateApi.apiKey}}"
            }
          ]
        }
      },
      "description": "Gets the final generated image from Replicate after processing",
      "typeVersion": 4.2
    },
    {
      "id": "fee42f2b-09d2-47f9-842a-52139e8c8de6",
      "name": "バリエーション画像の送信",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2740,
        280
      ],
      "webhookId": "c2af49c2-2c87-4020-928a-ce18f14e557f",
      "parameters": {
        "file": "={{ $json.output }}",
        "chatId": "={{ $json.message.chat.id }}",
        "operation": "sendDocument",
        "additionalFields": {
          "caption": "Here's an AI-generated variation of your image! 🚀"
        }
      },
      "description": "Sends the AI-generated variation back to the user",
      "typeVersion": 1.2
    },
    {
      "id": "93c43617-3c40-451f-b3b5-eb1d276db1ba",
      "name": "ファイルパスの取得",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1220,
        340
      ],
      "parameters": {
        "url": "https://api.telegram.org/bot{{$credentials.telegramBot.botToken}}/getFile",
        "options": {},
        "jsonBody": "={\n  \"file_id\": \"{{ $json.result.photo[0].file_id }}\"\n}\n",
        "sendBody": true,
        "specifyBody": "json"
      },
      "description": "Retrieves the file path from Telegram's servers",
      "typeVersion": 4.2
    },
    {
      "id": "71391d58-693a-4c6e-9180-a7b5819bdd3f",
      "name": "処理待機",
      "type": "n8n-nodes-base.wait",
      "position": [
        2080,
        600
      ],
      "webhookId": "eb746bd1-bead-4d9c-b5d5-6c1a1b605c20",
      "parameters": {
        "amount": 45
      },
      "description": "Waits for Replicate to complete the image generation (45 seconds)",
      "typeVersion": 1.1
    },
    {
      "id": "736f5bc9-3785-486d-a93a-d6e9cbd5e45b",
      "name": "セットアップドキュメント",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        380
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 400,
        "content": "## 📝 Setup Instructions\n\n1. Configure credentials:\n   - OpenAI API key\n   - Telegram Bot token\n   - Replicate API key\n\n2. Update the chat IDs to match your Telegram users/groups\n\n3. Test the workflow by sending an image with caption to your bot\n\n4. Optional: Adjust prompts and parameters to customize the AI behavior"
      },
      "typeVersion": 1
    },
    {
      "id": "2873e80c-d160-4bbc-88e7-89097adaa0bd",
      "name": "注: Replicate 出力を送信",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2640,
        20
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 440,
        "content": "### Telegram: Send Replicate Output\n\nSends the final video generated by Replicate back to the user via Telegram as a document.\n\n**Note:** The `Chat ID` is dynamically pulled from the trigger node (`={{ $json.message.chat.id }}`).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "65e13c0b-cf11-4c15-8de4-a6633e621a43",
      "name": "注: Replicate 結果を取得",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2420,
        580
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "height": 400,
        "content": "### Replicate API: Get Result\n\nPeriodically (after the wait) calls the URL provided by Replicate for the prediction result. This node downloads the final video output.\n\n**Note:** Replace `{{ $env[\"REPLICATE_API_TOKEN\"] }}` with your actual Replicate API token. The `Response Format` is set to `Base64` to prepare the output for sending via Telegram.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d6f4bd9c-6016-45a1-9318-c37aa5786e34",
      "name": "注: 編集済み画像を送信",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        500
      ],
      "parameters": {
        "color": 6,
        "width": 280,
        "height": 380,
        "content": "### Telegram: Send Edited Image\n\nSends the image edited by OpenAI back to the user who triggered the workflow.\n\n**Note:** The `Chat ID` is dynamically pulled from the trigger node (`={{ $json.message.chat.id }}`).\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "93c43617-3c40-451f-b3b5-eb1d276db1ba": {
      "main": [
        [
          {
            "node": "906ba4d2-445c-477f-8732-be7e9d828ba0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e8096804-b5a7-4f2f-943b-e4a5db0929fb": {
      "main": [
        [
          {
            "node": "93c43617-3c40-451f-b3b5-eb1d276db1ba",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f651bd6f-dc2f-4d60-b896-2c860ef0673f": {
      "main": [
        [
          {
            "node": "8e50ff8a-6c4b-486e-9307-9624fc7ff274",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "71391d58-693a-4c6e-9180-a7b5819bdd3f": {
      "main": [
        [
          {
            "node": "ab244f36-31e3-4dea-9c8e-e4935335810a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0db7b2f0-dfb2-4c92-98c8-d5eb27ca54f3": {
      "main": [
        [
          {
            "node": "f651bd6f-dc2f-4d60-b896-2c860ef0673f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8e50ff8a-6c4b-486e-9307-9624fc7ff274": {
      "main": [
        [
          {
            "node": "e8096804-b5a7-4f2f-943b-e4a5db0929fb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab244f36-31e3-4dea-9c8e-e4935335810a": {
      "main": [
        [
          {
            "node": "fee42f2b-09d2-47f9-842a-52139e8c8de6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "906ba4d2-445c-477f-8732-be7e9d828ba0": {
      "main": [
        [
          {
            "node": "71391d58-693a-4c6e-9180-a7b5819bdd3f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

上級 - デザイン, 人工知能, マーケティング

有料ですか?

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

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

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

作成者

AI & Automation Consultant. Sharing cool stuff on my YouTube Channel

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34