Prompt-Based Object Detection with Google Gemini 2.0 in n8n

This workflow uses Google Gemini 2.0’s AI to identify and draw bounding boxes around specific objects, like rabbits, in images. It solves the tedious manual task of object detection by automating it with prompt-based AI, saving significant time and improving accuracy.
manualTrigger
httpRequest
editImage
+3
Workflow Identifier: 2253
NODES in Use: Manual Trigger, HTTP Request, Edit Image, Code, Set, Sticky Note
Automate object detection with Google Gemini 2.0 in n8n

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow helps you find and mark all rabbits in a picture automatically. It solves the problem of spending too much time drawing boxes around animals by hand. You get an image with clear boxes around every rabbit after running it.

The workflow downloads an image, checks its size, asks Google Gemini 2.0 to detect rabbits by giving it the image and a simple prompt, gets box coordinates, scales them to the real image size, and finally draws the boxes on the image.


Who should use this workflow

The workflow is good for anyone who has many animal photos to tag but does not want to draw boxes manually. It works well for hobby photographers, petting zoo site managers, and small content creators who want fast, easy tagging with AI.

You do not need to be a coder or expert. You just need access to n8n and Google Gemini API, and you can automatically label rabbits in pictures.


Tools and services used

  • n8n automation platform: Runs the workflow and nodes.
  • Google Gemini 2.0 API: Does AI object detection from prompts.
  • HTTP Request node: Downloads images and calls APIs.
  • Edit Image node: Reads image size and draws boxes.
  • Code node: Runs JavaScript to rescale boxes.
  • Set node: Prepares coordinates and size data.

Beginner step-by-step: How to use this workflow in n8n

Download and import

  1. Download the workflow file using the Download button on this page.
  2. Open n8n editor (cloud or self-host n8n server).
  3. Click “Import from File” and select the saved workflow file.

Configure credentials and input

  1. Add Google Gemini 2.0 API credentials in n8n’s credential manager.
  2. Check the HTTP Request node called “Gemini 2.0 Object Detection” uses the correct credentials.
  3. Make sure the HTTP Request node named “Get Test Image” has the image URL: https://www.stonhambarns.co.uk/wp-content/uploads/jennys-ark-petting-zoo-for-website-6.jpg.
  4. If needed, update prompt text inside the body JSON of the Gemini request to detect other animals.

Test and activate

  1. Click the Manual Trigger node to start the workflow.
  2. Check the last node named “Draw Bounding Boxes” for the output image with boxes.
  3. If the result looks good, activate the workflow for production use.

Inputs, processing, and outputs

Inputs

  • Image URL from the HTTP Request node.
  • User prompt text telling AI what to detect (e.g., “rabbits”).
  • Google Gemini 2.0 API credentials.

Processing steps

  • Download image and get its width and height.
  • Send image and prompt to Google Gemini 2.0 for bounding box detection.
  • Parse JSON response containing normalized bounding boxes.
  • Use JavaScript code to convert normalized coordinates (0–1000 scale) to real image pixels.
  • Draw boxes on the original image at correct pixel positions.

Outputs

  • An image file with pink boxes visibly drawn around detected rabbits.
  • JSON data of bounding box coordinates (optional for further use).

Common problems and fixes

  • Empty or error in bounding box JSON:
    Check Google Gemini API response format. Inspect HTTP response raw data. Adjust JSON path in Set node.
  • Boxes not matching image:
    Verify image width and height in Get Image Info node. Check if scaling code matches dimension units.
  • API call fails:
    Ensure correct API Key and permissions. Confirm internet connection.
  • Too few or too many boxes drawn:
    Match number of draw steps in Draw Bounding Boxes with detected coordinates count.

Customization ideas

  • Change prompt in Gemini API call to find other animals or objects.
  • Adjust bounding box color HEX in Draw Bounding Boxes node for different highlight styles.
  • Build a loop or dynamic step generator for an unknown number of boxes.
  • Use user-uploaded or database images instead of the fixed test image URL.

Summary of benefits and outcomes

✓ Save hours by automating rabbit detection in photos.

✓ Get accurate bounding boxes drawn on images ready for websites.

✓ Use simple prompt text to customize object detection.

→ Easily integrate this into larger image workflows or content management.

→ Ideal for non-technical users with step-by-step import and configuration instructions.


Automate object detection with Google Gemini 2.0 in n8n

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Frequently Asked Questions

Yes, change the prompt text in the Google Gemini 2.0 Object Detection node to name other animals.
Check if the Get Image Info node retrieves correct image width and height. Verify scaling code uses these values correctly.
Download the workflow file, open n8n editor, use Import from File option, add required API credentials, update prompt or URLs if needed, then test and activate.
Each object detection call counts as one request, so manage usage carefully and batch requests when possible.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.