AutomationFlowsWeb Scraping › Batch ID Photo Converter & Enhancer with Google Drive & Nano Banana API

Batch ID Photo Converter & Enhancer with Google Drive & Nano Banana API

Bypanyanyany @panyanyany on n8n.io

This n8n workflow automatically converts and enhances multiple photos into professional ID-style portraits using Gemini AI (Nano Banana). It processes images in batch from Google Drive, applies professional ID photo standards (proper framing, neutral background, professional…

Event trigger★★★★☆ complexity16 nodesHTTP RequestGoogle DriveForm Trigger
Web Scraping Trigger: Event Nodes: 16 Complexity: ★★★★☆ Added:

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

This workflow follows the Form Trigger → Google Drive 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": "1f6e5HSDWrQSzgEt",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Batch ID Photo Converter & Enhancer With Google Drive & Nano Banana API",
  "tags": [],
  "nodes": [
    {
      "id": "1b27c0b9-2433-45a5-b303-96809323537d",
      "name": "Obtain the generated status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        464,
        -32
      ],
      "parameters": {
        "url": "https://api.defapi.org/api/task/query",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "task_id",
              "value": "={{$json.data.task_id}}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7b26f227-aaf0-4942-992d-ba03d124ebd7",
      "name": "Send Image Generation Request to Defapi.org API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        32,
        -32
      ],
      "parameters": {
        "url": "https://api.defapi.org/api/image/gen",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"prompt\": \"{{$json.prompt}}\",\n  \"model\": \"google/nano-banana\",\n  \"images\": [\"{{ $json.image }}\"]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "00981a5b-1a3e-49d3-93c5-dd2e204f20e2",
      "name": "Wait for Image Processing Completion",
      "type": "n8n-nodes-base.wait",
      "position": [
        240,
        -32
      ],
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "9d2169f3-20a1-42a5-bb02-c75a061e8c06",
      "name": "Check if Image Generation is Complete",
      "type": "n8n-nodes-base.if",
      "position": [
        688,
        -32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "db9a5dec-997b-4c3f-9582-37c9bbeb19ff",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "=pending"
            },
            {
              "id": "9352ce97-6628-4135-a8e3-35af03688d5d",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "1862d1cf-b65e-4839-9947-b70f666bba19",
      "name": "Format and Display Image Results",
      "type": "n8n-nodes-base.set",
      "position": [
        32,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fa5f375f-cddc-4f7b-a018-67c28015d18b",
              "name": "markdown_content",
              "type": "string",
              "value": "=\n- Generation result: {{$json.data?.status}}\n  \n{{$json.data?.result?.[0]?.text}}  \n{{$json.data?.status_reason?.message}}  \n\n![Example Image]({{$json.data?.result?.[0]?.image}})"
            },
            {
              "id": "1d219e61-a59b-4156-b284-42cc42ce6f6d",
              "name": "image",
              "type": "string",
              "value": "={{$json.data?.result?.[0]?.image}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6dba5850-1ab2-4ffb-9160-6c780a779dbe",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        464
      ],
      "parameters": {
        "color": 4,
        "width": 528,
        "height": 336,
        "content": "## Google Drive Input Dir\n![Image](https://i.imgur.com/7VcUtl6.jpeg)"
      },
      "typeVersion": 1
    },
    {
      "id": "59a4c0ca-baad-4378-8ab6-9817f10ddd20",
      "name": "Search files and folders",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        256,
        -384
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "url",
            "value": "={{ $json['Google Drive - Input Folder URL'] }}"
          }
        },
        "options": {
          "fields": "={{ [\"mimeType\",\"name\",\"id\",\"webViewLink\", \"imageMediaMetadata\", \"webContentLink\", \"thumbnailLink\"] }}"
        },
        "resource": "fileFolder",
        "returnAll": true
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "682a50fc-7d1d-44b2-993f-02c5bd792541",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -544
      ],
      "parameters": {
        "width": 352,
        "height": 320,
        "content": "## How to use drive\n- Prepare two folders. \n  - One for input: https://drive.google.com/drive/folders/xxxxxxx\n  - One for output: https://drive.google.com/drive/folders/yyyyyy\n- Maker your folders public"
      },
      "typeVersion": 1
    },
    {
      "id": "cf6a8583-dc11-447c-bcd0-6fe365b973af",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        32,
        -384
      ],
      "parameters": {
        "options": {},
        "formTitle": "Set Google Drive",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Google Drive - Input Folder URL",
              "requiredField": true
            },
            {
              "fieldLabel": "Google Drive - Output Folder URL",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Prompt",
              "placeholder": "Create a professional portrait suitable for ID documentation with proper spacing and composition.  Framing: Include the full head, complete shoulder area, and upper torso. Maintain generous margins around the subject without excessive cropping.  Outfit: Transform the existing attire into light business-casual clothing appropriate for the individual's demographics and modern style standards. Ensure the replacement garment appears natural, properly tailored, and complements the subject's overall presentation (such as professional shirt, refined blouse, contemporary blazer, or sophisticated layered separates).  Pose & Gaze: Position shoulders square to the camera, maintaining perfect frontal alignment. Direct the gaze straight ahead into the lens at identical eye height, avoiding any angular deviation in vertical or horizontal planes.  Expression: Display a professional neutral demeanor or subtle closed-lip smile that conveys confidence and authenticity.  Background: Utilize a solid, consistent light gray photographic background (color code: #d9d9d9) without any pattern, texture, or tonal variation.  Lighting & Quality: Apply balanced studio-quality illumination eliminating harsh contrast or reflective artifacts. Deliver maximum resolution imagery with precise focus and accurate natural skin color reproduction."
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0af17c30-f6fa-49f4-a9f1-44ebb337fe9f",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        480,
        -384
      ],
      "parameters": {
        "jsCode": "/**\n * Encodes multiple binary files from an n8n input item into Base64 strings.\n *\n * This code assumes it is running in an n8n \"Code\" or \"Function\" node\n * where 'this' refers to the node's context and 'helpers' are available.\n *\n * @returns {object} An object containing an array of file objects,\n * each with a 'path' and 'data' (Base64 string).\n */\nconst results = [];\n\nconsole.log('---- x', $input.all())\n\nfor (const item of $input.all()) {\n  const result = {}\n  result.prompt = $('On form submission').first().json.Prompt || $(\"On form submission\").params.formFields.values[2].placeholder\n  result.image = item.json.webContentLink\n  result.name = item.json.name\n  results.push(result)\n}\n\n\n\n// Return the final object in the expected format for the next node.\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "84851efc-02db-4557-8aeb-4a5eb01f2fa4",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        480,
        288
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('On form submission').item.json['Google Drive - Output Folder URL'] }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "7d7326d2-f6e9-4b53-b2e9-896fc2fa88a0",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        256,
        288
      ],
      "parameters": {
        "url": "={{ $json.image }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c758902f-a550-4ba7-a94c-72e7cc798233",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        464
      ],
      "parameters": {
        "color": 4,
        "width": 528,
        "height": 336,
        "content": "## Google Drive Output Dir\n![Image](https://i.imgur.com/j5mWcqz.jpeg)"
      },
      "typeVersion": 1
    },
    {
      "id": "e66266e6-b49c-43b5-abfa-04fef281d549",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -544
      ],
      "parameters": {
        "width": 672,
        "height": 320,
        "content": "## Load Images From Google Drive Input Dir\n\n1. **On form submission** (Form Trigger) - Collects Google Drive folder URLs and optional prompt\n2. **Search files and folders** (Google Drive) - Retrieves all files from the input folder\n3. **Code in JavaScript** (Code Node) - Prepares image data and prompt for API request"
      },
      "typeVersion": 1
    },
    {
      "id": "a012c005-137a-4108-86c1-321a12af4a5e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -176
      ],
      "parameters": {
        "width": 880,
        "height": 288,
        "content": "## Send Image to Nano Banana API (Defapi.org)\n4. **Send Image Generation Request to Defapi.org API** (HTTP Request) - Submits generation request for each image\n5. **Wait for Image Processing Completion** (Wait Node) - Waits 10 seconds before checking status\n6. **Obtain the generated status** (HTTP Request) - Polls API for completion status\n7. **Check if Image Generation is Complete** (IF Node) - Checks if status is not \"pending\""
      },
      "typeVersion": 1
    },
    {
      "id": "1bf5927f-d8d6-4b61-adac-b3868bccdd84",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        160
      ],
      "parameters": {
        "width": 880,
        "height": 288,
        "content": "## Download Images And Upload to Google Drive\n8. **Format and Display Image Results** (Set Node) - Formats result with markdown and image URL\n9. **HTTP Request** (HTTP Request) - Downloads the generated image file\n10. **Upload file** (Google Drive) - Uploads the enhanced photo to the output folder"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "92598834-25e9-447c-9eac-6134da030888",
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Send Image Generation Request to Defapi.org API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Obtain the generated status": {
      "main": [
        [
          {
            "node": "Check if Image Generation is Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format and Display Image Results": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Image Processing Completion": {
      "main": [
        [
          {
            "node": "Obtain the generated status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Image Generation is Complete": {
      "main": [
        [
          {
            "node": "Format and Display Image Results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Image Processing Completion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Image Generation Request to Defapi.org API": {
      "main": [
        [
          {
            "node": "Wait for Image Processing Completion",
            "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

This n8n workflow automatically converts and enhances multiple photos into professional ID-style portraits using Gemini AI (Nano Banana). It processes images in batch from Google Drive, applies professional ID photo standards (proper framing, neutral background, professional…

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

More Web Scraping workflows → · Browse all categories →

Related workflows

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

Web Scraping

The Sora 2 API allows seamless generation of CGI ads, turning text prompts into stunning videos. This workflow automates the entire process from video generation to upload, notification, and file shar

Form Trigger, HTTP Request, Email Send +1
Web Scraping

Formtrigger Workflow. Uses formTrigger, googleDrive, httpRequest, stopAndError. Event-driven trigger; 28 nodes.

Form Trigger, Google Drive, HTTP Request +1
Web Scraping

Formtrigger Workflow. Uses formTrigger, googleDrive, httpRequest, stopAndError. Event-driven trigger; 28 nodes.

Form Trigger, Google Drive, HTTP Request +1
Web Scraping

Create CGI ads effortlessly by integrating the Google Veo3 API for video generation and uploading to Google Drive with seamless email notifications. On form submission: Triggers the workflow when a fo

Form Trigger, HTTP Request, Email Send +1
Web Scraping

This workflow automates the process of generating videos using the Veo 3 Fast API, uploading the video to Google Drive, and notifying the user via email. All tasks are executed seamlessly, ensuring a

Form Trigger, HTTP Request, Email Send +1