Sora GPT、Google Drive、Sheetsを使ってAI画像を生成して保存

中級

これはContent Creation, Multimodal AI分野の自動化ワークフローで、11個のノードを含みます。主にCode, FormTrigger, GoogleDrive, HttpRequest, GoogleSheetsなどのノードを使用。 Sora GPT、Google Drive、Sheets を使用して AI 画像を生成して保存

前提条件
  • Google Drive API認証情報
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752"
  },
  "nodes": [
    {
      "id": "ffd9cc3e-8d6b-4b7c-a600-39f9511f4e19",
      "name": "フォーム送信時",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        80,
        -60
      ],
      "webhookId": "664f5a3c-d13b-4831-96e7-5a80567a5dbe",
      "parameters": {
        "options": {},
        "formTitle": "Image to Image Using GPT Sora",
        "formFields": {
          "values": [
            {
              "fieldType": "textarea",
              "fieldLabel": "Prompt",
              "requiredField": true
            },
            {
              "fieldLabel": "Image url",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Add Image and prompt to recreate your desired image"
      },
      "typeVersion": 2.2
    },
    {
      "id": "1b9fef9c-259e-4885-8596-c9319de01180",
      "name": "HTTP リクエスト",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        300,
        -60
      ],
      "parameters": {
        "url": "https://sora-gpt-image.p.rapidapi.com/ai-img/img-to-img.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "={{ $json.Prompt }}"
            },
            {
              "name": "img_url",
              "value": "={{ $json['Image url'] }}"
            },
            {
              "name": "width",
              "value": "1024"
            },
            {
              "name": "height",
              "value": "1024"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "sora-gpt-image.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1f2d4911-0151-4e7a-a3f5-f2f4ab2230ea",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1740,
        -360
      ],
      "parameters": {
        "columns": {
          "value": {
            "Image": "={{ $binary.data.fileName }}",
            "Prompt": "={{ $('On form submission').item.json.Prompt }}",
            "Generated Date": "={{ $('On form submission').item.json.submittedAt }}"
          },
          "schema": [
            {
              "id": "Prompt",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Prompt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generated Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Generated Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19RkfJHHLt15sIwaeN5Fgrd4BuVTacA0_mYP-gPcBVao/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "214a0309-83a7-4d8b-99b3-5809a97533cd",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1340,
        -220
      ],
      "parameters": {
        "name": "={{ $binary.data.fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "bc885b5f-d31b-4f5e-9ada-a4a5e421eb82",
      "name": "コード",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        -60
      ],
      "parameters": {
        "jsCode": "const base64String = $input.first().json.image_base64;\nconsole.log(base64String);\n// If it includes a prefix like 'data:image/jpeg;base64,', split it\nconst cleanedBase64 = base64String.includes(\",\")\n  ? base64String.split(\",\")[1]\n  : base64String;\n\nreturn [\n  {\n    binary: {\n      data: {\n        data: Buffer.from(cleanedBase64, 'base64'),\n        mimeType: 'image/jpeg', // or image/png depending on the format\n        fileName: 'output.jpg'\n      }\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "26c911dc-2f63-4d8e-b8a0-b54634d17b81",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -920,
        -540
      ],
      "parameters": {
        "width": 580,
        "height": 3080,
        "content": "# **Image to Image Using GPT Sora**\n\n## **How It Works**\n\n1. **Form Submission**:  \n   - Users submit a **prompt** and an **image URL** through the form. The prompt is the description for the image, and the URL points to an image to be used in conjunction with the prompt.\n\n2. **Image Generation via GPT AI**:  \n   - The flow sends the prompt and the image URL to the **GPT AI-powered service** via the **Sora GPT Image API**. The AI processes the request and generates a new image based on the input prompt.\n\n3. **Base64 Image Conversion**:  \n   - Once the image is generated, the flow converts the returned base64-encoded image data into a usable image file (e.g., JPEG) using the **Code Node**.\n\n4. **Google Drive Integration**:  \n   - The image file is then automatically uploaded to **Google Drive** for storage, making it easily shareable and accessible.\n\n5. **Google Sheets Logging**:  \n   - The details of the image (e.g., the prompt, generated image file, and generation date) are logged in **Google Sheets**, ensuring that a record is kept of all generated images for easy tracking and management.\n\n## **Use Case**\n\nThis flow allows users to leverage GPT-powered AI for generating images based on prompts, perfect for content creators, designers, marketers, and businesses needing quick image creation. It’s a great solution for the following scenarios:\n\n- **Content Creators**: Quickly generate unique, AI-powered images based on detailed prompts or themes.\n- **Marketers**: Create promotional images or visuals that align with specific marketing campaigns, increasing engagement.\n- **Designers**: Prototype new visual ideas or generate variations of designs based on specific themes or concepts.\n- **Developers/Tech Enthusiasts**: Automate and integrate image creation within other workflows or applications to scale content production.\n  \nThe integration with **Google Sheets** and **Google Drive** ensures that all generated images are stored and organized for easy access and sharing.\n\n## **Benefits**\n\n### **1. Time-Saving Automation**\nThis process automates multiple tasks, from generating images with GPT AI to uploading them to **Google Drive** and recording the relevant details in **Google Sheets**. It eliminates the need for manual image generation and management.\n\n### **2. AI-Powered Creativity**\nHarness the power of GPT and AI to generate images that align with the user’s input prompts. It allows users to create unique visuals that may not be possible through traditional methods or tools.\n\n### **3. Seamless Integration with Google Tools**\nThe flow integrates with **Google Drive** for image storage and **Google Sheets** for organizing and tracking image data. This ensures that all assets and their corresponding data (such as prompts, generated date, and file names) are easily accessible and stored securely.\n\n### **4. Scalable Image Generation**\nThe flow can handle large volumes of image generation requests. This is ideal for businesses that need a high quantity of images on a regular basis, such as social media managers, eCommerce businesses, or digital marketing agencies.\n\n### **5. Easy Access and Sharing**\nGenerated images are automatically stored in **Google Drive**, allowing for easy sharing and access. Whether you need to share the image with a team member or download it for use, the process is smooth and quick.\n\n### **6. Flexibility**\nUsers can specify the desired **prompt** and **image URL** to customize the image generation process. Additionally, users can adjust image parameters (such as size) to suit their specific needs.\n\n## **Problems Resolved**\n\n### **1. Manual Image Generation**\nCreating images manually is time-consuming, especially if you're trying to match specific prompts. By leveraging GPT-powered AI, this flow allows for quick, automated image generation based on detailed descriptions. This eliminates the need for manual image design or edits.\n\n### **2. Poor Data Organization**\nWithout proper organization, it can be challenging to manage and track images. This flow ensures that every image is not only generated but also saved in **Google Drive** and logged in **Google Sheets** with relevant details (prompt, image URL, generation date). This makes it easy to keep track of images over time.\n\n### **3. Storage Issues**\nManually uploading images to cloud storage can be cumbersome and prone to errors. With the automated integration with **Google Drive**, images are automatically uploaded and stored, ensuring they are safe and accessible at all times without requiring manual intervention.\n\n### **4. Lack of Integration**\nIn many workflows, users have to use multiple platforms for various tasks. This flow connects **GPT AI for image generation**, **Google Drive for storage**, and **Google Sheets for tracking** into one streamlined process. It removes the need for managing separate tools and consolidates the entire process into a single, automated flow.\n\n### **5. Inconsistent File Handling**\nHandling different image formats and file names manually can lead to inconsistencies. This flow uses **n8n** to cleanly handle images, converting base64 strings into actual image files and saving them in the correct format, eliminating errors in file handling.\n\n## **Technical Specifications**\n\n- **GPT API**: Uses the **Sora GPT Image API** to generate images based on text prompts.\n  - **API Endpoint**: [Sora GPT Image API](https://sora-gpt-image.p.rapidapi.com/ai-img/img-to-img.php)\n  - **RapidAPI Key**: You must provide your RapidAPI key for authentication.\n  \n- **Google Drive**: Uploads the generated image to a specified Google Drive folder.\n  \n- **Google Sheets**: Logs relevant image details (prompt, image, and generation date) in a Google Sheets document.\n  - **Spreadsheet URL**: [Google Sheets Link](https://docs.google.com/spreadsheets/d/19RkfJHHLt15sIwaeN5Fgrd4BuVTacA0_mYP-gPcBVao/edit#gid=0)\n\n## **Conclusion**\n\nThe **Image to Image Using GPT Sora** flow offers a simple yet powerful solution for generating and managing AI-powered images. By integrating the **Sora GPT Image API**, **Google Drive**, and **Google Sheets**, this flow streamlines the entire process, from image creation to storage and tracking. It’s an essential tool for content creators, marketers, designers, and businesses that need efficient image generation and management.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6513598b-6cb9-4ae9-b1c2-167fcb57c581",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -380
      ],
      "parameters": {
        "width": 500,
        "height": 440,
        "content": "## 1. **On Form Submission**\n   - **Type**: `n8n-nodes-base.formTrigger`\n   - **Function**: \n     - This node is triggered when a user submits a form. The form collects two inputs: a **prompt** (text) and an **image URL**.\n     - It ensures that the **Prompt** and **Image URL** fields are filled out before proceeding to the next node in the flow.\n   - **Parameters**:\n     - **Form Title**: `Image to Image Using GPT Sora`\n     - **Form Fields**: The form expects two fields, **Prompt** and **Image URL**.\n     - **Webhook ID**: This is a unique identifier for the form submission webhook."
      },
      "typeVersion": 1
    },
    {
      "id": "29045bc9-0dcd-453e-aa3c-722e94aef44d",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        -560
      ],
      "parameters": {
        "width": 440,
        "height": 660,
        "content": "## 2. HTTP Request to Sora GPT Image API\n   - **Type**: `n8n-nodes-base.httpRequest`\n   - **Function**: \n     - This node sends the **Prompt** and **Image URL** data to the **Sora GPT Image API** to generate a new image based on the provided prompt and image.\n     - The request is made via a `POST` method to the API endpoint:  \n       **`https://sora-gpt-image.p.rapidapi.com/ai-img/img-to-img.php`**.\n   - **Parameters**:\n     - **Method**: `POST`  \n     - **Headers**: Authentication using the RapidAPI key for **Sora GPT Image API**.\n     - **Body Parameters**:\n       - **Prompt**: The user's prompt describing the desired image.\n       - **Image URL**: The image URL provided by the user to be used as a reference.\n       - **Width & Height**: Set to `1024` for both, defining the size of the output image."
      },
      "typeVersion": 1
    },
    {
      "id": "73ecda33-8fb7-4d90-b510-b2c70914af02",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -540
      ],
      "parameters": {
        "width": 300,
        "height": 640,
        "content": "## 3. **Code (Base64 Conversion)**\n   - **Type**: `n8n-nodes-base.code`\n   - **Function**:\n     - This node is used to process the base64-encoded image data returned from the API.\n     - It converts the base64 string into a binary image file, which can then be uploaded to **Google Drive**.\n   - **Code Logic**: \n     - The code cleans the base64 string (if it contains a prefix) and decodes it to generate a proper image file.\n     - It stores the image in a `JPEG` format.\n   - **Parameters**: \n     - The generated binary image data is passed on to the next node (Google Drive)."
      },
      "typeVersion": 1
    },
    {
      "id": "4c95d81d-907d-4c15-af58-e08f919234c6",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1180,
        -660
      ],
      "parameters": {
        "width": 380,
        "height": 680,
        "content": "## 4. **Upload Image to Google Drive**\n   - **Type**: `n8n-nodes-base.googleDrive`\n   - **Function**:\n     - This node uploads the generated image (from the **Code** node) to **Google Drive**.\n     - It ensures that the image is saved with the name specified in the code and is stored in a designated folder.\n   - **Parameters**:\n     - **Authentication**: Uses a **Google Service Account** to authenticate and access the Google Drive.\n     - **File Name**: The name of the image (generated file) as set in the **Code** node.\n     - **Folder ID**: A folder on **Google Drive** where the image will be stored."
      },
      "typeVersion": 1
    },
    {
      "id": "9a8d33bc-572d-48ea-9585-20eeb24e24c4",
      "name": "付箋5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        -880
      ],
      "parameters": {
        "width": 420,
        "height": 720,
        "content": "## 5. **Log Details to Google Sheets**\n   - **Type**: `n8n-nodes-base.googleSheets`\n   - **Function**:\n     - This node logs the **Prompt**, **Generated Image**, and **Generation Date** into a **Google Sheets** document for tracking.\n     - It ensures that all relevant information is stored in an organized manner for later reference or auditing.\n   - **Parameters**:\n     - **Authentication**: Uses a **Google Service Account** for authentication.\n     - **Google Sheets Document ID**: Identifies the specific Google Sheets document where the details will be logged.\n     - **Sheet Name**: Defines the specific sheet (e.g., **Sheet1**) within the Google Sheets document.\n     - **Columns Mapped**:\n       - **Prompt**: The prompt entered by the user.\n       - **Image**: The file name of the generated image.\n       - **Generated Date**: The date and time when the image was generated.\n     - **Mapping Mode**: Defines how to map the data from the input to the appropriate sheet columns.\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "bc885b5f-d31b-4f5e-9ada-a4a5e421eb82": {
      "main": [
        [
          {
            "node": "214a0309-83a7-4d8b-99b3-5809a97533cd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "214a0309-83a7-4d8b-99b3-5809a97533cd": {
      "main": [
        [
          {
            "node": "1f2d4911-0151-4e7a-a3f5-f2f4ab2230ea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b9fef9c-259e-4885-8596-c9319de01180": {
      "main": [
        [
          {
            "node": "bc885b5f-d31b-4f5e-9ada-a4a5e421eb82",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ffd9cc3e-8d6b-4b7c-a600-39f9511f4e19": {
      "main": [
        [
          {
            "node": "1b9fef9c-259e-4885-8596-c9319de01180",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

中級 - コンテンツ作成, マルチモーダルAI

有料ですか?

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

関連ワークフロー

IMDBビデオ自動ダウンローダー(Google Driveアップロード&メール通知付き)
IMDB動画自動ダウンロードツール(Google Driveアップロード+メールアラート付き)
If
Wait
Email Send
+
If
Wait
Email Send
19 ノードSk developer
コンテンツ作成
RapidAPI と Google Sheets を使用した自動類似度検出とメールリポート
RapidAPI と Google スプレッドシートで自動類似チェックとメールリポート
If
Code
Email Send
+
If
Code
Email Send
19 ノードSk developer
コンテンツ作成
トップクラスのリバーシブルリンクチェッカーAPIを使ってサイトのリバーシブルリンクを分析し、Google Sheetsに記録
トップクラスのバックリンクチェッカーAPIを使ってサイトのバックリンクを分析し、Google Sheetsに記録
Code
Form Trigger
Http Request
+
Code
Form Trigger
Http Request
13 ノードSk developer
市場調査
RapidAPIとGoogle SheetsでSEOキーワード分析を自動化
RapidAPIとGoogle シートを使ったSEOキーワード分析の自動化
Code
Form Trigger
Http Request
+
Code
Form Trigger
Http Request
9 ノードSk developer
市場調査
WordPressブログの自動化プロフェッショナル版(先端研究)v2.1マーケットプラグイン
GPT-4o、Perplexity AI、そして多言語対応を使ったSEO最適化ブログ作成の自動化
If
Set
Xml
+
If
Set
Xml
125 ノードDaniel Ng
コンテンツ作成
販売税計算 API と Google Sheets を使って販売税の自動計算
売上税計算APIとGoogle Sheetsを使った自動売上税計算の実装
Code
Form Trigger
Http Request
+
Code
Form Trigger
Http Request
9 ノードSk developer
請求書処理
ワークフロー情報
難易度
中級
ノード数11
カテゴリー2
ノードタイプ6
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34