← All N8N workflows
Media & contentCodeEdit ImageHTTP RequestManual TriggerEdit Fields

build your own image search using ai object detection cdn and elasticsearch

Configured with Edit Image, HTTP Request. Review the connections and setup before adapting this template.

Workflow preview
TriggerWhen clicking ‘Testworkflow’Manual TriggerTransformGet VariablesEdit FieldsWeb / APIGet Test ImageHTTP RequestWeb / APIGemini 2.0 ObjectDetectionHTTP RequestCodeScale Normalised CoordsCodeFiles / mediaDraw Bounding BoxesEdit ImageFiles / mediaGet Image InfoEdit Image

Node categories in this workflow

  • Trigger
  • Transform
  • Web / API
  • Code
  • Files / media

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
When clicking ‘Test workflow’TriggerManual TriggerSee node parameters
Get VariablesTransformEdit FieldsSee node parameters
Get Test ImageWeb / APIHTTP RequestSee node parameters
Gemini 2.0 Object DetectionWeb / APIHTTP RequestPOST
Scale Normalised CoordsCodeCodeSee node parameters
Draw Bounding BoxesFiles / mediaEdit ImagemultiStep
Get Image InfoFiles / mediaEdit Imageinformation

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • googlePalmApi

Workflow notes

Sticky Note

Fig 1. Output of Object Detection

1. Download Test Image

1. Download Test Image

Read more about the HTTP node

Any compatible image will do (see docs) but best if it isn't too busy or the subjects too obscure. Most importantly, you are able to retrieve the width and height as this is required for a later step.

2. Use Prompt-Based Object Detection

2. Use Prompt-Based Object Detection

Read more about the HTTP node

We've had generalised object detection before (see my other template using ResNet) but being able to prompt for what you're looking for is a very exciting proposition! Not only could this reduce the effort in post-detection filtering but also introduce contextual use-cases such as searching by "emotion", "locality", "anomolies" and many more!

I found the the output json schema of { "box_2d": { "type": "array", ... } } works best for Gemini to return coordinates.

3. Scale Coords to Fit Original Image

3. Scale Coords to Fit Original Image

Read more about the Code node

According to the Gemini 2.0 overview on how it calculates bounding boxes, we'll have to rescale the coordinate values as they are normalised to a 0-1000 range. Nothing a little code node can't help with!

Q. Why not use the Basic LLM node?

Q. Why not use the Basic LLM node?

At time of writing, Langchain version does not recognise Gemini 2.0 to be a multimodal model.

4. Draw!

4. Draw!

Read more about the Edit Image node

Finally for this demonstration, we can use the "Edit Image" node to draw the bounding boxes on top of the original image. In my test run, I can see Gemini did miss out one of the bunnies but seeing how this is the experimental version we're playing with, it's pretty good to see it doesn't do too bad of a job.

Try it out!

Try it out!

This n8n template demonstrates how to use Gemini 2.0's new Bounding Box detection capabilities your workflows.

The key difference being this enables prompt-based object detection for images which is pretty powerful for things like contextual search over an image. eg. "Put a bounding box around all adults with children in this image" or "Put a bounding box around cars parked out of bounds of a parking space".

How it works

  • An image is downloaded via the HTTP node and an "Edit Image" node is used to extract the file's width and height.
  • The image is then given to the Gemini 2.0 API to parse and return coordinates of the bounding box of the requested subjects. In this demo, we've asked for the AI to identify all bunnies.
  • The coordinates are then rescaled with the original image's width and height to correctl align them.
  • Finally to measure the accuracy of the object detection, we use the "Edit Image" node to draw the bounding boxes onto the original image.

Need Help?

Join the Discord or ask in the Forum!

Happy Hacking!

build your own image search using ai object detection cdn and elasticsearch

build your own image search using ai object detection cdn and elasticsearch

Purpose and structure

This folder contains the build your own image search using ai object detection cdn and elasticsearch workflow. Its executable nodes use code, editImage, httpRequest, manualTrigger, set. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

When clicking ‘Test workflow’

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0665_Code_Editimage_Update_Webhook.json MIT; preserve source notices.

More in Media & content