Skip to main content

Extract Image Labels

Extracts labels and tags from images using Google Vision API's label detection feature.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Vision Client Id - The unique identifier of the Vision API connection, typically obtained from the Connect node.
  • Image Path - The file path to the image from which to extract labels.

Options

  • Credentials - Google Cloud service account credentials (optional - use instead of Connect node). If provided, the node will create its own client connection without requiring a Vision Client ID.

Output

  • Labels - An array of descriptive labels detected in the image, or "No labels found" if no labels are detected. Each label is a string describing objects, concepts, activities, or attributes found in the image.

How It Works

The Extract Image Labels node analyzes an image and returns descriptive labels that represent the content of the image. When executed, the node:

  1. Retrieves the Vision API client using the provided client ID
  2. Validates that the image path is not empty
  3. Opens and reads the image file from the specified path
  4. Creates a Vision API image object from the file
  5. Calls the DetectLabels method to identify labels in the image
  6. Processes the results and returns the detected labels

Requirements

  • A valid connection to Vision API established with the Connect node
  • Valid Google Cloud credentials with appropriate permissions
  • An image file accessible from the specified path
  • Enabled Vision API in your Google Cloud project

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Vision Client ID
  • Empty image path
  • Invalid image file path
  • File read errors
  • Invalid image format
  • Network connectivity issues
  • Vision API service errors
  • Authentication failures

Usage Notes

  • The Vision Client ID must be obtained from a successful Connect node execution (or provide credentials directly)
  • The image file must be accessible from the specified path
  • Supported image formats include JPEG, PNG, GIF, BMP, TIFF, and WebP
  • The node returns up to 10 labels for each image
  • Labels are returned as an array of strings describing the image content
  • If no labels are found, the output will be "No labels found"
  • Labels can be used for image categorization, tagging, or search indexing
  • Labels are machine-generated and may not perfectly match human descriptions

Example Use Cases

Auto-Tag Product Images

Input:
Vision Client Id: (from Connect node)
Image Path: /products/shoe_red_001.jpg

Output:
Labels: ["Footwear", "Shoe", "Red", "Fashion accessory", "Sneakers", "Athletic shoe", "Running shoe", "Product", "Outdoor shoe"]

Usage: Save labels to database for search and filtering

Categorize User-Uploaded Photos

1. File System > List Files
Directory: /uploads
Output: image_files

2. Loop through image_files
For each image:
- Extract Image Labels
Image Path: {{image}}
Output: labels

- Programming > Evaluate
Categorize based on labels:
if (labels.includes("Food")) category = "food";
else if (labels.includes("Person")) category = "people";
else if (labels.includes("Building")) category = "architecture";

- File System > Move File
Destination: /sorted/{{category}}/{{image}}

Build Image Search Index

1. Extract Image Labels
Image Path: /photos/vacation_001.jpg
Output: labels

2. Database > Insert
Table: photo_index
Data:
photo_id: vacation_001
file_path: /photos/vacation_001.jpg
labels: {{labels}}
date_indexed: {{now}}

3. Later: Search photos by label
Query: SELECT * FROM photo_index WHERE labels LIKE '%Beach%'

Content-Based Image Organization

1. Extract Image Labels
Image Path: {{screenshot}}
Output: detected_labels

2. Programming > Evaluate
Code:
const labels = message.detected_labels;
message.contains_chart = labels.includes("Chart") || labels.includes("Plot");
message.contains_text = labels.includes("Text") || labels.includes("Document");
message.contains_person = labels.includes("Person") || labels.includes("Face");

3. Flow > Router
Route based on content type for different processing workflows

E-commerce Product Classification

1. Extract Image Labels
Image Path: /new_products/{{product_id}}.jpg
Output: product_labels

2. Programming > Evaluate
Auto-assign product categories:
- If labels include "Clothing" -> Category: Apparel
- If labels include "Electronics" -> Category: Tech
- If labels include "Food" -> Category: Grocery

3. Update product database with auto-detected category

Quality Control for Image Assets

1. Extract Image Labels
Image Path: /marketing/campaign_image.jpg
Output: labels

2. Programming > Evaluate
Verify expected content:
const hasProduct = labels.includes("Product");
const hasLogo = labels.includes("Logo");

if (!hasProduct) {
message.error = "Product not detected in marketing image";
message.needs_review = true;
}

3. Send notification if quality check fails

Tips

  • Label Relevance: First few labels are usually most relevant and have higher confidence
  • Multiple Variations: Labels may include synonyms (e.g., "Footwear" and "Shoe")
  • Generic to Specific: Labels range from generic ("Product") to specific ("Running shoe")
  • Combine with Text: Use with Image to Text for complete image understanding
  • Threshold Logic: Implement your own filtering if 10 labels is too many for your use case
  • Case Sensitivity: Labels are returned with proper capitalization
  • Batch Processing: Reuse connection for processing multiple images efficiently
  • Label Validation: Cross-reference with your own taxonomy if needed

Common Errors and Solutions

Error: "Image Path cannot be empty"

Solution: Ensure the Image Path input is populated with a valid file path

Error: "No such file or directory"

Solution: Verify the file path is correct and the file exists at the specified location

Error: "Invalid Client"

Solution: Ensure Connect node ran successfully and Vision Client ID is properly passed, or provide credentials directly

Output: "No labels found"

Solution:

  • Check if the image contains recognizable objects or scenes
  • Verify image quality and clarity
  • Try with a different, more detailed image
  • Some abstract or unclear images may not generate labels

Unexpected Labels

Solution:

  • Vision API uses machine learning which may interpret images differently than humans
  • Consider using multiple labels together for better classification
  • Implement filtering logic to use only relevant labels
  • Combine with other Vision features for better accuracy

Label Examples by Image Type

Nature/Outdoor Photos

Typical labels: "Nature", "Sky", "Cloud", "Tree", "Landscape", "Mountain", "Water", "Grass"

Food Photos

Typical labels: "Food", "Dish", "Cuisine", "Meal", "Ingredient", "Tableware", "Recipe"

People Photos

Typical labels: "Person", "People", "Face", "Smile", "Human", "Portrait", "Group"

Architecture/Buildings

Typical labels: "Building", "Architecture", "House", "Structure", "Urban", "City", "Window"

Products

Typical labels: "Product", "Object", "Item", "Design", "Material", specific product types

Documents/Screenshots

Typical labels: "Text", "Font", "Document", "Screenshot", "Paper", "Page", "Writing"