## Guide de configuration

Intermédiaire

Ceci est unContent Creation, Multimodal AIworkflow d'automatisation du domainecontenant 13 nœuds.Utilise principalement des nœuds comme If, Set, Code, Wait, FormTrigger. Générer des photos de style vintage Polaroid avec Gemini AI

Prérequis
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "MomV5viXB16wUmuP",
  "meta": {
    "instanceId": "61055bd86de35ef46fd36e8f404f58e3f9ad437c028cde71d16413774416da74"
  },
  "name": "Generate Vintage Polaroid Style Photo with Gemini AI",
  "tags": [],
  "nodes": [
    {
      "id": "af84ccab-6bfc-4223-a846-200942e41371",
      "name": "Note adhésive3",
      "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": "Obtenir l'état de génération",
      "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": "Envoyer la requête de génération d'image à 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": "Attendre l'achèvement du traitement d'image",
      "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": "Vérifier si la génération d'image est terminée",
      "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": "Formater et afficher les résultats d'image",
      "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": "Note adhésive2",
      "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": "Note adhésive4",
      "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 en 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": "Note adhésive",
      "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": "Téléverser 2 images",
      "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": "Note adhésive5",
      "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": "Note adhésive1",
      "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
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Création de contenu, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Workflows recommandés

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds13
Catégorie2
Types de nœuds7
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34