AutomationFlows › AI & RAG › Enhance Google Drive Images with Gemini 2.5 Flash AI

Enhance Google Drive Images with Gemini 2.5 Flash AI

ByEdisson Garcia @eagarciah707 on n8n.io

🚀 Google Drive Image Enhancement with Gemini nano banana This workflow automates image enhancement by integrating Google Drive with Google Gemini. It fetches unprocessed images from a source folder, applies AI-driven transformations based on a customizable prompt (e.g., clean…

Event trigger★★★★☆ complexity18 nodesHTTP RequestGoogle Drive
AI & RAG Trigger: Event Nodes: 18 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #9442 — we link there as the canonical source.

This workflow follows the Google Drive → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "CTqDPrpw33Mx1pP2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "product-ia",
  "tags": [],
  "nodes": [
    {
      "id": "729ee875-0ba7-4a2a-95d7-fbd17efcb46f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -608,
        272
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "8d616ad2-1bd5-4754-86b6-309ddfbcd6e1",
      "name": "to base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -192,
        288
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "fadb23df-a7fa-421b-afd0-f3805e73577b",
      "name": "banana-request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        288
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"generationConfig\": {\n    \"temperature\": 1,\n    \"topP\": 0.95,\n    \"responseModalities\": [\n      \"IMAGE\"    \n]\n  },\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": {{ JSON.stringify($('Loop Over Items').item.json.promt) }}\n        },\n        {\n          \"inline_data\": {\n            \"mime_type\": \"{{ $json.mime || 'image/jpeg' }}\",\n            \"data\": \"{{ $json.data }}\"\n          }\n        }\n      ]\n    }\n  ]\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "9e5f8617-2adc-48ff-8fa5-2e1615fc8bc8",
      "name": "config-data",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1b7b1b4d-5816-4bf8-9a55-71228beb4158",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "de4eae64-9572-4f19-812e-207b279450e4",
              "name": "mimeType",
              "type": "string",
              "value": "={{ $json.mimeType }}"
            },
            {
              "id": "ae880747-407d-4dd1-8330-97ed5916da86",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "658e7776-e6c6-4f45-a72e-df6b25f578b8",
              "name": "promt",
              "type": "string",
              "value": "={{ $('promt').item.json.promt }}\n**no devuelvas texto, solo la imagen."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c1e9280b-0296-453a-a082-e04cc8e17238",
      "name": "download-file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -384,
        288
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "0184b05e-caba-4633-8833-39d759444d2c",
      "name": "map-banana-response",
      "type": "n8n-nodes-base.set",
      "position": [
        192,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6ad020c0-aabe-4687-a9e5-e26855038c2e",
              "name": "base64File",
              "type": "string",
              "value": "={{ ($json.candidates?.[0]?.content?.parts || [])\n     .find(p => p?.inlineData?.data)?.inlineData?.data\n   ?? '' }}\n"
            },
            {
              "id": "b8980368-9f10-4b99-91b2-426c0b5b10e5",
              "name": "",
              "type": "string",
              "value": ""
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "2cbc4f5f-56a6-4924-80ac-36af06b7ea1a",
      "name": "to file",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        368,
        288
      ],
      "parameters": {
        "options": {
          "fileName": "={{ $('download-file').item.json.name }}"
        },
        "operation": "toBinary",
        "sourceProperty": "base64File"
      },
      "typeVersion": 1.1
    },
    {
      "id": "8e55ade0-e8dc-4191-a412-16ded6c8d45f",
      "name": "upload-result",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        528,
        288
      ],
      "parameters": {
        "name": "={{ $binary.data.fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('destination_folder').item.json.id }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "5a73c2f9-7958-4fe3-b1d8-48eec637bf0f",
      "name": "get files",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -48,
        80
      ],
      "parameters": {
        "url": "https://www.googleapis.com/drive/v3/files",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "='{{ $('origin_folder').item.json.id }}' in parents and trashed=false"
            },
            {
              "name": "fields",
              "value": "nextPageToken,files(id,name,mimeType,size,modifiedTime,webViewLink,webContentLink)"
            },
            {
              "name": "pageSize",
              "value": "1000"
            }
          ]
        },
        "nodeCredentialType": "googleDriveOAuth2Api"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2a5d63a0-1b12-4b47-b6b1-15455e09b7a5",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        288,
        80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9525fec4-05f1-43b0-a304-91664a8a524a",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.mimeType }}",
              "rightValue": "image"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3652eadc-654e-41a1-a244-339d2278c7a8",
      "name": "map table",
      "type": "n8n-nodes-base.code",
      "position": [
        112,
        80
      ],
      "parameters": {
        "jsCode": "// items[0].json.files => Array de archivos\nconst files = (items[0]?.json?.files) ?? [];\n\nreturn files.map(f => ({\n  json: {\n    id: f.id,\n    name: f.name,\n    mimeType: f.mimeType,\n    webContentLink: f.webContentLink,\n    webViewLink: f.webViewLink,\n    modifiedTime: f.modifiedTime,\n    // convierte size a n\u00famero si viene como string\n    size: f.size ? Number(f.size) : null,\n  }\n}));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "7e19951e-2b71-49a1-8028-be4b7a680d24",
      "name": "init",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -672,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "47703d0d-9a31-4772-ad71-ac41c0b7c066",
      "name": "promt",
      "type": "n8n-nodes-base.set",
      "position": [
        -528,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "dd6f9abd-a587-46ec-8f52-df5090ade50d",
              "name": "promt",
              "type": "string",
              "value": "Agrega un fondo realista y limpio para un producto de pa\u00f1ales en la foto.|El entorno debe transmitir cuidado, suavidad y confort, resaltando al producto sin distraer.Usa fondos como:superficies de madera clara o blanca,telas suaves (algod\u00f3n, manta, lino),habitaciones luminosas para beb\u00e9,Evita colores fuertes, saturados o demasiado oscuros.Mant\u00e9n la atenci\u00f3n en el pa\u00f1al y que el fondo solo complemente.el producto deber\u00eda ocupar el 90% del espacio."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c86cf75b-09fc-4a8c-b075-befcc0b1a786",
      "name": "origin_folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -368,
        80
      ],
      "parameters": {
        "limit": 1,
        "filter": {},
        "options": {},
        "resource": "fileFolder",
        "queryString": "imagenes_sin_procesar"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "617bdb61-f68a-4cac-9b5c-2a582945110b",
      "name": "destination_folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -208,
        80
      ],
      "parameters": {
        "limit": 1,
        "filter": {},
        "options": {},
        "resource": "fileFolder",
        "queryString": "imagenes_sin_procesar"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c2dca6af-2c01-4ed3-a617-506358d0a2db",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -192
      ],
      "parameters": {
        "width": 880,
        "height": 96,
        "content": "1 \u2013 Overview\n\nThis workflow processes images from **Google Drive** using **Google Gemini**.\nFlow: Origin \u2192 Filter images \u2192 Download \u2192 Base64 \u2192 Gemini \u2192 New image \u2192 Upload to destination folder.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "03593940-5575-4717-b453-a2b61613855c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -48
      ],
      "parameters": {
        "width": 368,
        "height": 96,
        "content": "Requirements\nActive credentials for Google Drive and Gemini API.\nOnly processes files where mimeType contains \"image\"."
      },
      "typeVersion": 1
    },
    {
      "id": "80dac2d0-e6db-4ac4-b486-83b325456156",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -48
      ],
      "parameters": {
        "width": 496,
        "height": 96,
        "content": "2 \u2013 Nodes to configure\npromt \u2192 edit the text with your instructions for Gemini (output style).\norigin_folder \u2192 in Search Query, set the name of the source folder.\ndestination_folder \u2192 in Search Query, set the name of the target folder."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "bfd67920-168e-4b04-aa2d-545ad3063ce2",
  "connections": {
    "init": {
      "main": [
        [
          {
            "node": "promt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "promt": {
      "main": [
        [
          {
            "node": "origin_folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "config-data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "to file": {
      "main": [
        [
          {
            "node": "upload-result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get files": {
      "main": [
        [
          {
            "node": "map table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "map table": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "to base64": {
      "main": [
        [
          {
            "node": "banana-request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "config-data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "download-file": {
      "main": [
        [
          {
            "node": "to base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "origin_folder": {
      "main": [
        [
          {
            "node": "destination_folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "upload-result": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "banana-request": {
      "main": [
        [
          {
            "node": "map-banana-response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "download-file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "destination_folder": {
      "main": [
        [
          {
            "node": "get files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "map-banana-response": {
      "main": [
        [
          {
            "node": "to file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

🚀 Google Drive Image Enhancement with Gemini nano banana This workflow automates image enhancement by integrating Google Drive with Google Gemini. It fetches unprocessed images from a source folder, applies AI-driven transformations based on a customizable prompt (e.g., clean…

Source: https://n8n.io/workflows/9442/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This n8n workflow automatically generates presentation-style "screen recording" videos with AI-generated slides and a talking head avatar overlay. You provide a topic and intention, and the workflow h

HTTP Request, N8N Nodes Veed, Google Drive +1
AI & RAG

Monitor Google Drive folder, parsing PDF, DOCX and image file into a destination folder, ready for further processing (e.g. RAG ingestion, translation, etc.) Keep processing log in Google Sheet and se

Google Drive Trigger, Google Drive, HTTP Request +2
AI & RAG

This workflow is ideal for content creators, video marketers, and research professionals who need to extract actionable insights, detailed transcripts, or metadata from YouTube videos efficiently. It

HTTP Request, Google Drive, Gmail +2
AI & RAG

Creators, designers, and developers exploring AI-powered image generation. Automation enthusiasts who want to integrate image creation into n8n workflows. Telegram bot builders looking to add visual A

Telegram Trigger, Airtable, HTTP Request +2
AI & RAG

Automatically watches a Google Drive folder, submits new documents to Landing.ai for parsing, caches processed files in - Supabase to avoid reprocessing, and reliably polls results with retry and time

Google Drive Trigger, Google Drive, Supabase +1