N
n8n Store
Workflow Market
Transform Your Selfies into 3D Figurines with Nano Banana AI

Transform Your Selfies into 3D Figurines with Nano Banana AI

by panyanyany0 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.ifn8n-nodes-base.setn8n-nodes-base.coden8n-nodes-base.waitn8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.formTriggern8n-nodes-base.httpRequest
PriceGratis
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "O4GSdLho332Jps5T",
  "meta": {
    "instanceId": "323608cbec55d18261b8bc24f73f48c4455cb4a115f1b3e3d2435ba7c138103c"
  },
  "name": "Transform Your Selfies into 3D Figurines with Nano Banana AI",
  "tags": [],
  "nodes": [
    {
      "id": "06a897f4-23bf-448b-a8a2-c2e58ff235ca",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 3,
        "width": 780,
        "height": 760,
        "content": "# Transform Your Selfies into 3D Figurines with Nano Banana AI\n\n## Overview\nThis workflow utilizes the Defapi API with Google's **Nano Banana AI** model to transform your selfies into stunning **3D figurines**, **action figures**, and collectible merchandise designs. Simply upload a selfie photo, provide a creative prompt describing your desired **3D figurine** or **action figure** design, and watch as AI generates professional-quality product visualizations.\n\n**Input:** Your selfie photo + creative prompt + API key  \n**Output:** AI-generated **3D figurine** and **action figure** designs perfect for collectibles, merchandise, and product visualization\n\nUsers can interact through a simple form, providing a text prompt describing the desired creative scene, a product image URL, and their API key. The system automatically submits the request to the Defapi API, monitors the generation status in real time, and retrieves the final creative image output. This solution is ideal for marketers, product designers, e-commerce businesses, and content creators who want to quickly generate compelling product advertisements and creative visuals with minimal setup. Perfect for creating **3D figurines** and collectible merchandise designs.\n\n\n## Prerequisites\n- A Defapi account and API key: Sign up at [Defapi.org](https://defapi.org/model/google/nano-banana) to obtain your API key.\n- An active n8n instance (cloud or self-hosted) with HTTP Request and form submission capabilities.\n- Basic knowledge of AI prompts for product creative generation to achieve optimal results, especially for **3D figurines** and collectible designs.\n  - Example prompt: Create a 1/7 scale commercialized **3D figurine** of the characters in the picture, in a realistic style, in a real environment. The **figurine** is placed on a computer desk. The **figurine** has a round transparent acrylic base, with no text on the base. The content on the computer screen is the Zbrush modeling process of this **figurine**. Next to the computer screen is a packaging box with rounded corner design and a transparent front window, the figure inside is clearly visible.\n\n- A product image for creative generation.\n- **Important Note**: Avoid using dark photos as input, as the generated **3D figurine** will also appear dark.\n\n## Setup Instructions\n1.  **Obtain API Key**: Register at Defapi.org and generate your API key. Store it securely—do not share it publicly.\n2.  **Configure the Form**: In the \"Upload Image\" form trigger node, ensure the following fields are set up: Image (file upload), API Key (text field), and Prompt (text field).\n3.  **Test the Workflow**:\n    - Click \"Execute Workflow\" in n8n.\n    - Access the generated form URL, upload your product image, enter your prompt, and provide your API key.\n    - The workflow will process the image through the \"Convert to JSON\" node, then send the request to the Defapi API.\n    - The system will wait 10 seconds and then poll the API status until the image generation is complete.\n4.  **Handle Outputs**: The final \"Format and Display Image Results\" node formats and displays the generated creative image URL for download or embedding.\n\n## Workflow Structure\nThe workflow consists of the following nodes:\n1. **Upload Image** (Form Trigger) - Collects user input: image file, API key, and prompt\n2. **Convert to JSON** (Code Node) - Converts uploaded image 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/nano-banana` (**Nano Banana 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**: **3D figurines**, collectible merchandise, and product visualization\n\n## Customization Tips\n- **Enhance Prompts**: Include specifics like scene setting, lighting, style (e.g., realistic, artistic, cinematic), product placement, and visual elements to improve AI creative image quality. For **3D figurines**, specify scale, materials, and display context.\n- **Form Fields**: The form accepts image files (image/*), API key (text), and prompt (text) as required fields.\n- **Error Handling**: The workflow includes conditional logic to check for successful completion before displaying results.\n- **Best Practices for **Nano Banana AI****: Use detailed descriptions for **figurine** designs, specify lighting conditions, and include environmental context for realistic **3D figurine** generation.\n- **Photo Quality Tips**: Use well-lit photos for best results. Avoid dark images as they will make the generated **3D figurine** appear dark too.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1829c8eb-71de-42b9-b639-d9d5ab14b751",
      "name": "Obtain the generated status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        448,
        832
      ],
      "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": "703a60bb-bef1-4b95-ab9a-3f7846b104bc",
      "name": "Send Image Generation Request to Defapi.org API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        16,
        832
      ],
      "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 }}\"]\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": "edc3adde-c4bb-444f-9b88-a3e3f3c93908",
      "name": "Wait for Image Processing Completion",
      "type": "n8n-nodes-base.wait",
      "position": [
        256,
        832
      ],
      "webhookId": "bb6c2821-9586-44b7-8606-2ee69a77ed75",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "5f185c51-de9f-4e14-8b35-b2f1f853ef52",
      "name": "Check if Image Generation is Complete",
      "type": "n8n-nodes-base.if",
      "position": [
        640,
        832
      ],
      "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": "0460ef13-34c0-4d8e-96ce-0b55d8e76bf1",
      "name": "Format and Display Image Results",
      "type": "n8n-nodes-base.set",
      "position": [
        816,
        816
      ],
      "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": "6308e14e-c71b-4fa7-90b4-6b6f7d30d5d9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        1056
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 576,
        "content": "## Input Photo\n![Product](https://i.imgur.com/s9KaIO2.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "fef5e68a-f44b-48f9-862d-8e16be66fed3",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        1040
      ],
      "parameters": {
        "width": 416,
        "height": 608,
        "content": "## Result Image\n![Creative](https://i.imgur.com/WoypJlD.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "871e4071-6f48-477e-bbf6-060f51ec415b",
      "name": "Upload Image",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -336,
        688
      ],
      "webhookId": "254a1336-57d2-4ba0-93e1-e8460fc94f00",
      "parameters": {
        "options": {},
        "formTitle": "Upload Image",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "Image",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": "image/*"
            },
            {
              "fieldLabel": "API Key",
              "requiredField": true
            },
            {
              "fieldLabel": "Prompt",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "196c9105-021b-4718-b04b-f2086721b0c0",
      "name": "Convert to JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        -128,
        688
      ],
      "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 bin = $input.first().binary['Image'];\n\n// Use n8n's helper function to get the file buffer.\nconst binBuffer = await this.helpers.getBinaryDataBuffer(0, 'Image');\n\n// Push a new object to the results array.\nresults.img_url = `data:${bin.mimeType};base64,${Buffer.from(binBuffer).toString('base64')}`\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": "f8bee05a-feef-4fce-9b7c-4041d4570312",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        816
      ],
      "parameters": {
        "content": "## Example prompt\nCreate a 1/7 scale commercialized figurine of the characters in the picture, in a realistic style, in a real environment. The figurine is placed on a computer desk. The figurine has a round transparent acrylic base, with no text on the base. The content on the computer screen is the Zbrush modeling process of this figurine.Next to the computer screen is a packaging box with rounded corner design and a transparent front window, the figure inside is clearly visible."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "888d4d4c-6200-49f7-8f21-b81499d324ef",
  "connections": {
    "Upload Image": {
      "main": [
        [
          {
            "node": "Convert to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON": {
      "main": [
        [
          {
            "node": "Send Image Generation Request to Defapi.org API",
            "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": [
        []
      ]
    },
    "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
          }
        ]
      ]
    }
  }
}

相关工作流