## Guía de configuración

Intermedio

Este es unContent Creation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 13 nodos.Utiliza principalmente nodos como If, Set, Code, Wait, FormTrigger. Usar Gemini AI para generar fotos con estilo retro Polaroid

Requisitos previos
  • 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": "MomV5viXB16wUmuP",
  "meta": {
    "instanceId": "61055bd86de35ef46fd36e8f404f58e3f9ad437c028cde71d16413774416da74"
  },
  "name": "Generate Vintage Polaroid Style Photo with Gemini AI",
  "tags": [],
  "nodes": [
    {
      "id": "af84ccab-6bfc-4223-a846-200942e41371",
      "name": "Nota Adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        -736
      ],
      "parameters": {
        "color": 3,
        "width": 780,
        "height": 760,
        "content": "# Generate Vintage Polaroid Style Photo with Gemini AI\n\n## Overview\nThis workflow uses the Defapi API with Google's **Gemini AI** to transform digital photos into authentic Polaroid-style vintage photographs. Upload your photos, provide a creative prompt, and get AI-generated vintage effects with that distinctive instant camera charm.\n\n**Input:** Digital photos + creative prompt + API key  \n**Output:** Polaroid-style vintage photographs\n\nThe system provides a simple form interface where users submit their images, prompt, and API key. It automatically processes requests through Defapi API, monitors generation status, and delivers the final vintage photo output. Ideal for photographers, content creators, and social media enthusiasts looking to add vintage charm to their digital photos.\n\n\n## Prerequisites\n- A Defapi account and API key: Sign up at [Defapi.org](https://defapi.org/model/google/gemini-2.5-flash-image)\n- An active n8n instance (cloud or self-hosted) with HTTP Request and form submission capabilities\n- Digital photos for transformation (well-lit photos work best)\n- Basic knowledge of AI prompts for vintage photo generation\n\n**Example prompt:** Take a picture with a Polaroid camera. The photo should exhibit rich saturation and vintage color cast, with soft tones, low contrast, and vignetting. The texture features distinct film grain. Do not change the faces. Replace the background behind the two people with a white curtain. Make them close to each other with clear faces and normal skin color.\n\n## Setup Instructions\n1. **Obtain API Key**: Register at Defapi.org and generate your API key. Store it securely.\n2. **Configure the Form**: Set up the \"Upload 2 Images\" form trigger with: Image 01 & Image 02 (file uploads), API Key (text field), and Prompt (text field).\n3. **Test the Workflow**:\n   - Click \"Execute Workflow\" in n8n\n   - Access the form URL, upload two photos, enter your prompt, and provide your API key\n   - The workflow processes images, sends the request to Defapi API, waits 10 seconds, then polls until generation is complete\n4. **Handle Outputs**: The final node displays the generated image URL for download or sharing.\n\n## Workflow Structure\nThe workflow consists of the following nodes:\n1. **Upload 2 Images** (Form Trigger) - Collects user input: two image files, API key, and prompt\n2. **Convert to JSON** (Code Node) - Converts uploaded images to base64 and formats data\n3. **Send Image Generation Request to Defapi.org API** (HTTP Request) - Submits generation request\n4. **Wait for Image Processing Completion** (Wait Node) - Waits 10 seconds before checking status\n5. **Obtain the generated status** (HTTP Request) - Polls API for completion status\n6. **Check if Image Generation is Complete** (IF Node) - Checks if status equals 'success'\n7. **Format and Display Image Results** (Set Node) - Formats final image URL output\n\n## Technical Details\n- **API Endpoint**: `https://api.defapi.org/api/image/gen` (POST request)\n- **Model Used**: `google/gemini` (**Gemini AI**)\n- **Status Check Endpoint**: `https://api.defapi.org/api/task/query` (GET request)\n- **Wait Time**: 10 seconds between status checks\n- **Image Processing**: Uploaded images are converted to base64 format for API submission\n- **Authentication**: Bearer token authentication using the provided API key\n- **Specialized For**: Polaroid-style vintage photography and instant camera effects\n\n## Customization Tips\n- **Enhance Prompts**: Include specifics like vintage color cast, film grain texture, vignetting, lighting conditions, and atmosphere to improve AI photo quality. Specify desired saturation levels and contrast adjustments.\n- **Photo Quality**: Use well-lit, clearly exposed photos for best results. The AI can simulate flash effects and vintage lighting, but quality input produces better output. Note that generated photos may sometimes be unclear or have incorrect skin tones - try multiple generations to achieve optimal results.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7c7629bf-0c92-4de1-b0b4-93d0bb097146",
      "name": "Obtener el estado generado",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        96
      ],
      "parameters": {
        "url": "https://api.defapi.org/api/task/query",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "task_id",
              "value": "={{$json.data.task_id}}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Convert to JSON').item.json.api_key }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a6ff7deb-a1d7-4b4b-b0cf-a97e56805a6d",
      "name": "Enviar Solicitud de Generación de Imagen a Defapi.org API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -752,
        96
      ],
      "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.img_url_01 }}\", \"{{ $json.img_url_02 }}\"]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.api_key }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "765b6cfd-8678-42f5-aad4-a4c197b0e628",
      "name": "Esperar Finalización del Procesamiento de Imagen",
      "type": "n8n-nodes-base.wait",
      "position": [
        -512,
        96
      ],
      "webhookId": "bb6c2821-9586-44b7-8606-2ee69a77ed75",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "ee3bce44-c556-42af-97aa-8e7fdae40285",
      "name": "Verificar si la Generación de Imagen está Completa",
      "type": "n8n-nodes-base.if",
      "position": [
        -128,
        96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "db9a5dec-997b-4c3f-9582-37c9bbeb19ff",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "=true",
              "rightValue": "={{ $json.data.status == 'success' }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "d88742b4-960c-4bab-84da-557ec413f71e",
      "name": "Formatear y Mostrar Resultados de Imagen",
      "type": "n8n-nodes-base.set",
      "position": [
        64,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fa5f375f-cddc-4f7b-a018-67c28015d18b",
              "name": "image_url",
              "type": "string",
              "value": "={{$json.data.result[0].image}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "22e91f6d-13a5-474a-9f93-0c66ba8540e8",
      "name": "Nota Adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        304
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 576,
        "content": "## Input Photo 1\n![Product](https://i.imgur.com/s9KaIO2.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "98a4119e-0e06-4a61-a215-b03cfc64058c",
      "name": "Nota Adhesiva4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        304
      ],
      "parameters": {
        "width": 640,
        "height": 608,
        "content": "## Result Image\n![Creative](https://i.imgur.com/1jYGhjc.jpeg)"
      },
      "typeVersion": 1
    },
    {
      "id": "9df109b4-077a-425b-ad08-a1b6246d4c9d",
      "name": "Convertir a JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        -896,
        -48
      ],
      "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\nconst getImageDataUrl = async (name) => {\n    const bin = $input.first().binary[name];\n    // Use n8n's helper function to get the file buffer.\n    const binBuffer = await this.helpers.getBinaryDataBuffer(0, name);\n    return `data:${bin.mimeType};base64,${Buffer.from(binBuffer).toString('base64')}`\n}\n\n// Push a new object to the results array.\nresults.img_url_01 = await getImageDataUrl('Image_01')\nresults.img_url_02 = await getImageDataUrl('Image_02')\nresults.api_key = $input.first().json['API Key']\nresults.prompt = $input.first().json['Prompt']\n\n// Return the final object in the expected format for the next node.\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c128c65c-f435-43d4-9d50-719429fa9510",
      "name": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        80
      ],
      "parameters": {
        "content": "## Example prompt\nTake a picture with a Polaroid camera. The photo should look like a normal photo, without any clear subjects or props. such as a flash from a dark room, spread throughout the photo.In terms of color, it exhibits rich saturation and a vintage color cast, with soft tones, low contrast, and often accompanied by vignetting. The texture features a distinct film grain. Do not change the faces. Replace the background behind the two people with a white curtain. Make them being close to each other.The face should be clear. Their skin should be normal color."
      },
      "typeVersion": 1
    },
    {
      "id": "bab5bb39-ecb4-41a7-9a31-06afed798ddd",
      "name": "Subir 2 Imágenes",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1104,
        -48
      ],
      "webhookId": "254a1336-57d2-4ba0-93e1-e8460fc94f00",
      "parameters": {
        "options": {},
        "formTitle": "Upload 2 Images",
        "formFields": {
          "values": [
            {
              "fieldLabel": "API Key",
              "requiredField": true
            },
            {
              "fieldLabel": "Prompt",
              "requiredField": true
            },
            {
              "fieldType": "file",
              "fieldLabel": "Image 01",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": "image/*"
            },
            {
              "fieldType": "file",
              "fieldLabel": "Image 02",
              "requiredField": true,
              "acceptFileTypes": "image/*"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1dfb0d0e-0b2c-4aa1-9a10-3b6750f797c4",
      "name": "Nota Adhesiva5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        304
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 576,
        "content": "## Input Photo 2\n![Product](https://i.imgur.com/t4GA0OJ.jpeg)"
      },
      "typeVersion": 1
    },
    {
      "id": "aaaa1a73-3682-49c4-b074-4ebb354abb6d",
      "name": "Nota Adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -192
      ],
      "parameters": {
        "height": 128,
        "content": "## Convert to JSON\nConvert binary data of image to base64-style data url."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "43634557-84b0-4613-a82e-ff722c925dd8",
  "connections": {
    "9df109b4-077a-425b-ad08-a1b6246d4c9d": {
      "main": [
        [
          {
            "node": "a6ff7deb-a1d7-4b4b-b0cf-a97e56805a6d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bab5bb39-ecb4-41a7-9a31-06afed798ddd": {
      "main": [
        [
          {
            "node": "9df109b4-077a-425b-ad08-a1b6246d4c9d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7c7629bf-0c92-4de1-b0b4-93d0bb097146": {
      "main": [
        [
          {
            "node": "ee3bce44-c556-42af-97aa-8e7fdae40285",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "765b6cfd-8678-42f5-aad4-a4c197b0e628": {
      "main": [
        [
          {
            "node": "7c7629bf-0c92-4de1-b0b4-93d0bb097146",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ee3bce44-c556-42af-97aa-8e7fdae40285": {
      "main": [
        [
          {
            "node": "d88742b4-960c-4bab-84da-557ec413f71e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "765b6cfd-8678-42f5-aad4-a4c197b0e628",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a6ff7deb-a1d7-4b4b-b0cf-a97e56805a6d": {
      "main": [
        [
          {
            "node": "765b6cfd-8678-42f5-aad4-a4c197b0e628",
            "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?

Intermedio - 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
Intermedio
Número de nodos13
Categoría2
Tipos de nodos7
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34