{
  "id": 5929,
  "name": "Text-to-image generation with Flux AI, Google Drive storage & sheets logging",
  "description": "# \ud83c\udfa8 AI Image Generator with Flux AI \n\nGenerate realistic, high-quality images from text prompts using the **Flux AI Text-to-Image Generator API** via RapidAPI, and seamlessly store the results in Google Drive and log them in Google Sheets \u2014 all automated using **n8n**.\n\n---\n\n## \ud83e\udde0 What This Workflow Does\n\nThis no-code automation enables you to:\n- \ud83d\udd8b\ufe0f Enter a **custom text prompt** using a web form.\n- \ud83d\uddbc\ufe0f Generate a **photorealistic image** using **[Flux AI\u2019s Text-to-Image Generator](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux)** via [RapidAPI](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux).\n- \u2601\ufe0f Upload the image to **Google Drive**.\n- \ud83d\udcca Log the prompt and result in a **Google Sheet**.\n- \u26a0\ufe0f Capture and log errors in a fallback sheet.\n\n---\n\n## \ud83d\udca1 Use Case\n\nIdeal for:\n- Digital artists and marketers\n- Social media managers\n- Brand mockup creators\n- Rapid concept prototyping\n\nAll without writing a single line of code.\n\n---\n\n## \u2705 Benefits\n\n- **No-code automation** for AI-generated images\n- **Cloud storage** and structured logging\n- **Error handling** built-in\n- **Fast content creation** for design, branding, or concept testing\n- **Powered by** the [Flux AI Text-to-Image Generator API](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux) via **RapidAPI**\n\n---\n\n## \ud83e\udde9 Node-by-Node Breakdown\n\n### 1. \ud83d\udcdd On Form Submission\n- Accepts user input for a creative text prompt.\n- \ud83d\udd0d Example: \u201cA silver can with vapor and blue lightning background.\u201d\n- \ud83d\udca1 Benefit: No technical knowledge needed.\n\n---\n\n### 2. \ud83c\udf10 HTTP Request \u2014 Flux AI API\n- Sends the prompt to the **[Flux AI Text-to-Image Generator API](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux)** via **RapidAPI**.\n- \ud83d\udce6 Returns an image encoded in base64.\n- \ud83d\udca1 Benefit: Seamless integration with cutting-edge image generation.\n\n---\n\n### 3. \ud83e\uddea Code Node \u2014 Base64 Decoder\n- Converts the base64 image to a binary `.jpg` file.\n- \ud83d\udca1 Benefit: Readies the image for upload/download/sharing.\n\n---\n\n### 4. \ud83d\udcc1 Google Drive\n- Uploads the generated image to your Google Drive folder.\n- \ud83d\udca1 Benefit: Secure, sharable cloud storage.\n\n---\n\n### 5. \ud83d\udcca Google Sheets \u2014 Success Log\n- Appends a row with the original prompt, filename, and generation date.\n- \ud83d\udca1 Benefit: Tracks history of all generated images.\n\n---\n\n### 6. \u26a0\ufe0f IF Node \u2014 Error Detection\n- Checks if the image generation failed.\n- \ud83d\udca1 Benefit: Prevents workflow from halting and routes to error logging.\n\n---\n\n### 7. \ud83d\udcc9 Google Sheets \u2014 Error Log\n- Logs failed prompts and error messages.\n- \ud83d\udca1 Benefit: Helps identify what went wrong (e.g. malformed prompt).\n\n---\n\n## \ud83d\udee0\ufe0f Challenges Solved\n\n| Problem | How This Workflow Fixes It |\n|--------|-----------------------------|\n| Manual prompt-based image generation is slow | Fully automated with Flux AI |\n| No storage pipeline for generated images | Integrated with Google Drive |\n| No audit trail for prompts/images | Logged into Google Sheets |\n| Errors go unnoticed in image generation | Built-in error check and logging |\n| Users lack API access or dev experience | Friendly web form UI |\n\n---\n\n## \ud83d\udd17 API Spotlight\n\nThis workflow is powered by the **[Flux AI Text-to-Image Generator API](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux)** \u2014 available exclusively on **RapidAPI**.\n\n### Why use this API?\n- Ultra-fast text-to-image rendering\n- High-resolution results\n- Developer-friendly and cost-effective\n- Great for branding, mockups, and visuals\n\nWe\u2019ve integrated this API to make advanced image generation accessible with just a prompt \u2014 no AI or dev experience required.\n\n---\n\n",
  "categories": [
    {
      "id": 31,
      "name": "Content Creation"
    },
    {
      "id": 51,
      "name": "Multimodal AI"
    }
  ],
  "totalViews": 1315,
  "createdAt": "2025-07-13T02:56:28.190Z",
  "workflow": {
    "meta": {
      "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752"
    },
    "nodes": [
      {
        "id": "5ce3fec1-830d-4814-aff0-c2fbe34aeb6e",
        "name": "On form submission",
        "type": "n8n-nodes-base.formTrigger",
        "position": [
          -1280,
          40
        ],
        "webhookId": "34937e21-14cc-40c7-adf9-d0d0cd0b6a33",
        "parameters": {
          "options": {},
          "formTitle": "Text To Image Flux AI",
          "formFields": {
            "values": [
              {
                "fieldType": "textarea",
                "fieldLabel": "Prompt",
                "placeholder": "A photograph of a \"Mateen\" Sommer Edition energy drink can, suspended in mid-air against a cool, gradient backdrop. The sleek silver can prominently displays the vibrant \"Neo hair lotion\" flavor, adorned with dynamic blue and white graphics and heavily frosted with condensation. Surrounding the can is a swirling cloud of frosty vapor composed of irregularly shaped, shimmering ice cubes, illuminated by a focused spotlight that highlights the can's metallic sheen. Soft, diffused lighting emphasizes the crispness of the energy drink and creates a refreshing atmosphere, setting it against a backdrop shifting from deep indigo to a lighter sky blue.",
                "requiredField": true
              }
            ]
          },
          "formDescription": "Add prompt to generate desired image"
        },
        "typeVersion": 2.2
      },
      {
        "id": "21190262-f358-4d1f-8341-f6e785aec8d0",
        "name": "HTTP Request",
        "type": "n8n-nodes-base.httpRequest",
        "onError": "continueErrorOutput",
        "position": [
          -1060,
          40
        ],
        "parameters": {
          "url": "https://text-to-image-generator-flux.p.rapidapi.com/flux.php",
          "method": "POST",
          "options": {},
          "sendBody": true,
          "sendHeaders": true,
          "bodyParameters": {
            "parameters": [
              {
                "name": "prompt",
                "value": "={{ $json.Prompt }}"
              }
            ]
          },
          "headerParameters": {
            "parameters": [
              {
                "name": "x-rapidapi-host",
                "value": "text-to-image-generator-flux.p.rapidapi.com"
              },
              {
                "name": "x-rapidapi-key",
                "value": "your key"
              }
            ]
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "bad3b411-7f24-42c9-8561-5ec659561c72",
        "name": "Code",
        "type": "n8n-nodes-base.code",
        "position": [
          -560,
          -120
        ],
        "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": "5d9f952e-88c4-4007-8c12-56e25b05194c",
        "name": "Google Sheets",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          -180,
          280
        ],
        "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": "credential-id",
            "name": "googleApi Credential"
          }
        },
        "typeVersion": 4.6
      },
      {
        "id": "9bcc807e-7e28-425b-a721-10c238502fc0",
        "name": "Google Drive",
        "type": "n8n-nodes-base.googleDrive",
        "position": [
          -240,
          -120
        ],
        "parameters": {
          "name": "=ok{{ $binary.data.fileName }}",
          "driveId": {
            "__rl": true,
            "mode": "url",
            "value": ""
          },
          "options": {},
          "folderId": {
            "__rl": true,
            "mode": "url",
            "value": ""
          },
          "authentication": "serviceAccount"
        },
        "credentials": {
          "googleApi": {
            "id": "credential-id",
            "name": "googleApi Credential"
          }
        },
        "typeVersion": 3
      },
      {
        "id": "0bd277e7-e5d5-4695-bd4c-656fc921aea1",
        "name": "If",
        "type": "n8n-nodes-base.if",
        "position": [
          -880,
          400
        ],
        "parameters": {
          "options": {},
          "conditions": {
            "options": {
              "version": 2,
              "leftValue": "",
              "caseSensitive": true,
              "typeValidation": "strict"
            },
            "combinator": "and",
            "conditions": [
              {
                "id": "205d9270-aa0e-4864-bbb6-c67206eda0a2",
                "operator": {
                  "type": "string",
                  "operation": "exists",
                  "singleValue": true
                },
                "leftValue": "={{ $json.error }}",
                "rightValue": ""
              }
            ]
          }
        },
        "typeVersion": 2.2
      },
      {
        "id": "2a72cd55-a8f1-4fe3-b632-d704afd4bce1",
        "name": "Google Sheets5",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          -520,
          480
        ],
        "parameters": {
          "columns": {
            "value": {
              "Base64": "={{ $json.error }}",
              "Prompt": "={{ $json.Prompt }}"
            },
            "schema": [
              {
                "id": "Prompt",
                "type": "string",
                "display": true,
                "removed": false,
                "required": false,
                "displayName": "Prompt",
                "defaultMatch": false,
                "canBeUsedToMatch": true
              },
              {
                "id": "drive path",
                "type": "string",
                "display": true,
                "removed": false,
                "required": false,
                "displayName": "drive path",
                "defaultMatch": false,
                "canBeUsedToMatch": true
              },
              {
                "id": "Generated Date",
                "type": "string",
                "display": true,
                "removed": false,
                "required": false,
                "displayName": "Generated Date",
                "defaultMatch": false,
                "canBeUsedToMatch": true
              },
              {
                "id": "Base64",
                "type": "string",
                "display": true,
                "removed": false,
                "required": false,
                "displayName": "Base64",
                "defaultMatch": false,
                "canBeUsedToMatch": true
              }
            ],
            "mappingMode": "defineBelow",
            "matchingColumns": [
              "Prompt"
            ],
            "attemptToConvertTypes": false,
            "convertFieldsToString": false
          },
          "options": {},
          "operation": "appendOrUpdate",
          "sheetName": {
            "__rl": true,
            "mode": "list",
            "value": "gid=0",
            "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mT6GkDE1_tcPzv6K1h9jHWyEVsg4d7Pj0UR1te3rGlg/edit#gid=0",
            "cachedResultName": "Sheet1"
          },
          "documentId": {
            "__rl": true,
            "mode": "url",
            "value": ""
          },
          "authentication": "serviceAccount"
        },
        "credentials": {
          "googleApi": {
            "id": "credential-id",
            "name": "googleApi Credential"
          }
        },
        "typeVersion": 4.6
      },
      {
        "id": "e5880625-4059-485e-a2ef-b0eed85992bb",
        "name": "Sticky Note",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -2340,
          -520
        ],
        "parameters": {
          "width": 740,
          "height": 1020,
          "content": "# \ud83c\udfa8 AI Image Generator with Flux AI \n\nGenerate images from text prompts using **Flux AI Text-to-Image Generator API** and automatically store results in **Google Drive** and log them in **Google Sheets**.\n\n---\n\n## \ud83e\udde0 Workflow Overview\n- **Form Submission**: User inputs a text prompt.\n- **API Request**: Sends prompt to **Flux AI Text-to-Image Generator** via [RapidAPI](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux).\n- **Image Processing**: Converts base64 image into a binary file.\n- **Google Drive Upload**: Saves the generated image to Drive.\n- **Google Sheets Log**: Stores prompt, image name, and date in Sheets.\n- **Error Handling**: Captures errors and logs them in a fallback sheet.\n\n---\n\n## \u2705 Benefits\n- **Automated AI Image Generation** without coding.\n- **Cloud storage** on Google Drive.\n- **Error Logging** for easier troubleshooting.\n- **Real-time tracking** in Google Sheets.\n\n---\n\n## \ud83d\ude80 Challenges Solved\n- **No API knowledge required**: Simplifies image generation.\n- **Error detection**: Ensures no failed processes go unnoticed.\n- **Automated file storage**: Direct upload to Google Drive.\n\n---\n\n## \ud83d\udd17 API: [Flux AI Text-to-Image Generator](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux)\n- Fast, high-quality, text-to-image API.\n- **Generate images** with just a prompt.\n\n---"
        },
        "typeVersion": 1
      },
      {
        "id": "b59714dd-74ea-4c7a-819e-0d64c188a2f5",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -1360,
          -160
        ],
        "parameters": {
          "height": 320,
          "content": "### 1. \ud83d\udcdd On Form Submission\n- Accepts user input for a creative text prompt.\n- \ud83d\udd0d Example: \u201cA silver can with vapor and blue lightning background.\u201d\n- \ud83d\udca1 Benefit: No technical knowledge needed."
        },
        "typeVersion": 1
      },
      {
        "id": "6b953a64-3f26-4e7e-9580-947f4a7d503d",
        "name": "Sticky Note2",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -1080,
          -160
        ],
        "parameters": {
          "height": 320,
          "content": "### 2. \ud83c\udf10 HTTP Request \u2014 Flux AI API\n- Sends the prompt to the **[Flux AI Text-to-Image Generator API](https://rapidapi.com/skdeveloper/api/text-to-image-generator-flux)** via **RapidAPI**.\n- \ud83d\udce6 Returns an image encoded in base64.\n- \ud83d\udca1 Benefit: Seamless integration with cutting-edge image generation."
        },
        "typeVersion": 1
      },
      {
        "id": "50588ad0-9f4b-4e90-ab90-9e0ae8f83595",
        "name": "Sticky Note3",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -640,
          -340
        ],
        "parameters": {
          "height": 380,
          "content": "### 3. \ud83e\uddea Code Node \u2014 Base64 Decoder\n- Converts the base64 image to a binary `.jpg` file.\n- \ud83d\udca1 Benefit: Readies the image for upload/download/sharing."
        },
        "typeVersion": 1
      },
      {
        "id": "9b412619-0589-4dbb-a601-8322bb571a6e",
        "name": "Sticky Note4",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -300,
          -320
        ],
        "parameters": {
          "height": 360,
          "content": "### 4. \ud83d\udcc1 Google Drive\n- Uploads the generated image to your Google Drive folder.\n- \ud83d\udca1 Benefit: Secure, sharable cloud storage.\n"
        },
        "typeVersion": 1
      },
      {
        "id": "b2913804-5555-4a30-b713-94236188a28e",
        "name": "Sticky Note5",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -240,
          100
        ],
        "parameters": {
          "height": 340,
          "content": "### 5. \ud83d\udcca Google Sheets \u2014 Success Log\n- Appends a row with the original prompt, filename, and generation date.\n- \ud83d\udca1 Benefit: Tracks history of all generated images."
        },
        "typeVersion": 1
      },
      {
        "id": "7fd8d0b3-d6f2-445a-810b-558ed33e1084",
        "name": "Sticky Note6",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -920,
          200
        ],
        "parameters": {
          "height": 320,
          "content": "### 6. \u26a0\ufe0f IF Node \u2014 Error Detection\n- Checks if the image generation failed.\n- \ud83d\udca1 Benefit: Prevents workflow from halting and routes to error logging."
        },
        "typeVersion": 1
      },
      {
        "id": "25e8bc2c-bf70-452c-bd7d-45052d9f85d6",
        "name": "Sticky Note7",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -580,
          300
        ],
        "parameters": {
          "height": 340,
          "content": "### 7. \ud83d\udcc9 Google Sheets \u2014 Error Log\n- Logs failed prompts and error messages.\n- \ud83d\udca1 Benefit: Helps identify what went wrong (e.g. malformed prompt)."
        },
        "typeVersion": 1
      }
    ],
    "pinData": {},
    "connections": {
      "If": {
        "main": [
          [
            {
              "node": "Google Sheets5",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Code": {
        "main": [
          [
            {
              "node": "Google Sheets",
              "type": "main",
              "index": 0
            },
            {
              "node": "Google Drive",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "HTTP Request": {
        "main": [
          [
            {
              "node": "Code",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "If",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "On form submission": {
        "main": [
          [
            {
              "node": "HTTP Request",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 15,
    "nodeTypes": {
      "n8n-nodes-base.if": {
        "count": 1
      },
      "n8n-nodes-base.code": {
        "count": 1
      },
      "n8n-nodes-base.stickyNote": {
        "count": 8
      },
      "n8n-nodes-base.formTrigger": {
        "count": 1
      },
      "n8n-nodes-base.googleDrive": {
        "count": 1
      },
      "n8n-nodes-base.httpRequest": {
        "count": 1
      },
      "n8n-nodes-base.googleSheets": {
        "count": 2
      }
    }
  },
  "nodes": [
    "On form submission",
    "HTTP Request",
    "Code",
    "Google Sheets",
    "Google Drive",
    "If",
    "Google Sheets5",
    "Sticky Note",
    "Sticky Note1",
    "Sticky Note2",
    "Sticky Note3",
    "Sticky Note4",
    "Sticky Note5",
    "Sticky Note6",
    "Sticky Note7"
  ],
  "nodeTypes": [
    "n8n-nodes-base.httpRequest",
    "n8n-nodes-base.code",
    "n8n-nodes-base.stickyNote",
    "n8n-nodes-base.if",
    "n8n-nodes-base.formTrigger",
    "n8n-nodes-base.googleSheets",
    "n8n-nodes-base.googleDrive"
  ]
}