Automate Image Validation Tasks using AI Vision n8n Workflow Template

n8n workflow template · 8 nodes · Google Drive

Automate Image Validation Tasks using AI Vision is a free n8n workflow template that starts when you run it manually in the n8n editor and works with Google Drive and Google Gemini. It has 8 nodes, 3 of them AI nodes (Structured Output Parser, Basic LLM Chain and Google Gemini Chat Model). The notes inside the workflow say: “OpenAI's vision model was found to perform well for understanding photographs and so is recommended for this type of workflow. However, any capable vision model should work.” To run it, you add your own credentials for Google Drive OAuth2 and Google Gemini (PaLM) API.

At a glance

Trigger
Manual Trigger (When clicking ‘Test workflow’)
Nodes
8
Apps
Google Drive and Google Gemini
AI nodes
3
Credentials
2 types
Category
Spreadsheets, databases and docs

Apps and integrations

  • Google Drive
  • Google Gemini

Node types used

  • Manual Trigger
  • Structured Output Parser
  • Edit Fields (Set)
  • Split Out
  • Google Drive
  • Edit Image
  • Basic LLM Chain
  • Google Gemini Chat Model

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Try It Out!

This workflow takes a portrait and verifies if it makes for a valid passport photo. It achieves this by using an AI vision model following the UK government guidance.

OpenAI's vision model was found to perform well for understanding photographs and so is recommended for this type of workflow. However, any capable vision model should work.

Need Help?

Join the Discord or ask in the Forum!

1. Import Photos To Validate

Read more about using Google Drive

In this demonstration, we'll import 5 different portraits to test our AI vision model. For convenience, we'll use Google Drive but feel free to swap this out for other sources such as other storage or by using webhooks.

2. Verify Passport Photo Validity Using AI Vision Model

Learn more about Basic LLM Chain

Verifying if a photo is suitable for a passport photo is a great use-case for AI vision and to automate the process is an equally great use-case for using n8n. Here's we've pasted in the UK governments guidelines copied from gov.uk and have asked the AI to validate the incoming photos following those rules. A structured output parser is used to simplify the AI response which can be used to update a database or backend of your choosing.

Nodes in this workflow

The 8 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. When clicking ‘Test workflow’ (Manual Trigger)
  2. Structured Output Parser (Structured Output Parser)
  3. Photo URLs (Edit Fields (Set))
  4. Photos To List (Split Out)
  5. Download Photos (Google Drive)
  6. Resize For AI (Edit Image)
  7. Passport Photo Validator (Basic LLM Chain)
  8. Google Gemini Chat Model (Google Gemini Chat Model)

Credentials you need

  • Google Drive OAuth2 – used by Download Photos
  • Google Gemini (PaLM) API – used by Google Gemini Chat Model

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us