Conversor y potenciador de fotos de identificación por lotes usando Google Drive y la API de Nano Banana

Avanzado

Este es unContent Creation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 16 nodos.Utiliza principalmente nodos como If, Set, Code, Wait, FormTrigger. Conversor y mejorador por lotes de fotos de identificación usando Google Drive y la API de Nano Banana

Requisitos previos
  • Credenciales de API de Google Drive
  • Pueden requerirse credenciales de autenticación para la API de destino
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "1f6e5HSDWrQSzgEt",
  "meta": {
    "instanceId": "8dc97f110c3d1c4c1312bf2ee1e5a9845338284bdb271e93c73c8939c0887ef7",
    "templateCredsSetupCompleted": true
  },
  "name": "Batch ID Photo Converter & Enhancer With Google Drive & Nano Banana API",
  "tags": [],
  "nodes": [
    {
      "id": "1b27c0b9-2433-45a5-b303-96809323537d",
      "name": "Obtener el estado generado",
      "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": {
          "id": "uZqL4UNyrG73Kntx",
          "name": "Defapi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7b26f227-aaf0-4942-992d-ba03d124ebd7",
      "name": "Enviar Solicitud de Generación de Imagen a 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": {
          "id": "uZqL4UNyrG73Kntx",
          "name": "Defapi account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "00981a5b-1a3e-49d3-93c5-dd2e204f20e2",
      "name": "Esperar la Finalización del Procesamiento de Imagen",
      "type": "n8n-nodes-base.wait",
      "position": [
        240,
        -32
      ],
      "webhookId": "bb6c2821-9586-44b7-8606-2ee69a77ed75",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "9d2169f3-20a1-42a5-bb02-c75a061e8c06",
      "name": "Verificar si la Generación de Imagen está Completa",
      "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": "Formatear y Mostrar Resultados de Imagen",
      "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": "Nota Adhesiva2",
      "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": "Buscar archivos y carpetas",
      "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": {
          "id": "ECFfMtuxT2HgQvFH",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "682a50fc-7d1d-44b2-993f-02c5bd792541",
      "name": "Nota Adhesiva",
      "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": "Al enviar el formulario",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        32,
        -384
      ],
      "webhookId": "d047f428-e1d7-4b23-bef4-50db362f1d67",
      "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": "Código en 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": "Subir archivo",
      "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": {
          "id": "ECFfMtuxT2HgQvFH",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "7d7326d2-f6e9-4b53-b2e9-896fc2fa88a0",
      "name": "Solicitud HTTP",
      "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": "Nota Adhesiva3",
      "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": "Nota Adhesiva1",
      "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": "Nota Adhesiva4",
      "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": "Nota Adhesiva5",
      "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,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "92598834-25e9-447c-9eac-6134da030888",
  "connections": {
    "7d7326d2-f6e9-4b53-b2e9-896fc2fa88a0": {
      "main": [
        [
          {
            "node": "84851efc-02db-4557-8aeb-4a5eb01f2fa4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0af17c30-f6fa-49f4-a9f1-44ebb337fe9f": {
      "main": [
        [
          {
            "node": "7b26f227-aaf0-4942-992d-ba03d124ebd7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cf6a8583-dc11-447c-bcd0-6fe365b973af": {
      "main": [
        [
          {
            "node": "59a4c0ca-baad-4378-8ab6-9817f10ddd20",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "59a4c0ca-baad-4378-8ab6-9817f10ddd20": {
      "main": [
        [
          {
            "node": "0af17c30-f6fa-49f4-a9f1-44ebb337fe9f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b27c0b9-2433-45a5-b303-96809323537d": {
      "main": [
        [
          {
            "node": "9d2169f3-20a1-42a5-bb02-c75a061e8c06",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1862d1cf-b65e-4839-9947-b70f666bba19": {
      "main": [
        [
          {
            "node": "7d7326d2-f6e9-4b53-b2e9-896fc2fa88a0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "00981a5b-1a3e-49d3-93c5-dd2e204f20e2": {
      "main": [
        [
          {
            "node": "1b27c0b9-2433-45a5-b303-96809323537d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9d2169f3-20a1-42a5-bb02-c75a061e8c06": {
      "main": [
        [
          {
            "node": "1862d1cf-b65e-4839-9947-b70f666bba19",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "00981a5b-1a3e-49d3-93c5-dd2e204f20e2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7b26f227-aaf0-4942-992d-ba03d124ebd7": {
      "main": [
        [
          {
            "node": "00981a5b-1a3e-49d3-93c5-dd2e204f20e2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Avanzado - Creación de contenido, IA Multimodal

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos16
Categoría2
Tipos de nodos8
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34