Google Cloud Platform logo

Google Cloud Vision API: Node.js Client

release level npm version codecov

Google Cloud Vision API client for Node.js

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Google Cloud Vision API API.
  4. Set up authentication with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/vision

Using the client library

async function quickstart() {
  // Imports the Google Cloud client library
  const vision = require('@google-cloud/vision');

  // Creates a client
  const client = new vision.ImageAnnotatorClient();

  // Performs label detection on the image file
  const [result] = await client.labelDetection('./resources/wakeupcat.jpg');
  const labels = result.labelAnnotations;
  console.log('Labels:');
  labels.forEach(label => console.log(label.description));
}

Samples

Samples are in the samples/ directory. The samples' README.md has instructions for running the samples.

Sample Source Code Try it
Detect source code Open in Cloud Shell
Detect.v1p1beta1 source code Open in Cloud Shell
Detect.v1p3beta1 source code Open in Cloud Shell
Face Detection source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell
Text Detection source code Open in Cloud Shell

The Google Cloud Vision API Node.js Client API Reference documentation also contains samples.

Versioning

This library follows Semantic Versioning.

This library is considered to be in beta. This means it is expected to be mostly stable while we work toward a general availability release; however, complete stability is not guaranteed. We will address issues and requests against beta libraries with a high priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

License

Apache Version 2.0

See LICENSE

google.cloud.vision.v1

google.cloud.vision.v1p1beta1

google.cloud.vision.v1p2beta1

google.cloud.vision.v1p3beta1

google.cloud.vision.v1p3beta1
google.cloud.vision.v1p3beta1.AddProductToProductSetRequest
google.cloud.vision.v1p3beta1.AnnotateFileResponse
google.cloud.vision.v1p3beta1.AnnotateImageRequest
google.cloud.vision.v1p3beta1.AnnotateImageResponse
google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest
google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse
google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest
google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse
google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest
google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse
google.cloud.vision.v1p3beta1.BatchOperationMetadata
google.cloud.vision.v1p3beta1.Block
google.cloud.vision.v1p3beta1.BlockType
google.cloud.vision.v1p3beta1.BoundingPoly
google.cloud.vision.v1p3beta1.BreakType
google.cloud.vision.v1p3beta1.ColorInfo
google.cloud.vision.v1p3beta1.CreateProductRequest
google.cloud.vision.v1p3beta1.CreateProductSetRequest
google.cloud.vision.v1p3beta1.CreateReferenceImageRequest
google.cloud.vision.v1p3beta1.CropHint
google.cloud.vision.v1p3beta1.CropHintsAnnotation
google.cloud.vision.v1p3beta1.CropHintsParams
google.cloud.vision.v1p3beta1.DeleteProductRequest
google.cloud.vision.v1p3beta1.DeleteProductSetRequest
google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest
google.cloud.vision.v1p3beta1.DetectedBreak
google.cloud.vision.v1p3beta1.DetectedLanguage
google.cloud.vision.v1p3beta1.DominantColorsAnnotation
google.cloud.vision.v1p3beta1.EntityAnnotation
google.cloud.vision.v1p3beta1.FaceAnnotation
google.cloud.vision.v1p3beta1.Feature
google.cloud.vision.v1p3beta1.GcsDestination
google.cloud.vision.v1p3beta1.GcsSource
google.cloud.vision.v1p3beta1.GetProductRequest
google.cloud.vision.v1p3beta1.GetProductSetRequest
google.cloud.vision.v1p3beta1.GetReferenceImageRequest
google.cloud.vision.v1p3beta1.Image
google.cloud.vision.v1p3beta1.ImageAnnotationContext
google.cloud.vision.v1p3beta1.ImageContext
google.cloud.vision.v1p3beta1.ImageProperties
google.cloud.vision.v1p3beta1.ImageSource
google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource
google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig
google.cloud.vision.v1p3beta1.ImportProductSetsRequest
google.cloud.vision.v1p3beta1.ImportProductSetsResponse
google.cloud.vision.v1p3beta1.InputConfig
google.cloud.vision.v1p3beta1.KeyValue
google.cloud.vision.v1p3beta1.Landmark
google.cloud.vision.v1p3beta1.LatLongRect
google.cloud.vision.v1p3beta1.Likelihood
google.cloud.vision.v1p3beta1.ListProductSetsRequest
google.cloud.vision.v1p3beta1.ListProductSetsResponse
google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest
google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse
google.cloud.vision.v1p3beta1.ListProductsRequest
google.cloud.vision.v1p3beta1.ListProductsResponse
google.cloud.vision.v1p3beta1.ListReferenceImagesRequest
google.cloud.vision.v1p3beta1.ListReferenceImagesResponse
google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation
google.cloud.vision.v1p3beta1.LocationInfo
google.cloud.vision.v1p3beta1.NormalizedBoundingPoly
google.cloud.vision.v1p3beta1.NormalizedVertex
google.cloud.vision.v1p3beta1.OperationMetadata

google.cloud.vision.v1p4beta1

google.cloud.vision.v1p4beta1
google.cloud.vision.v1p4beta1.AddProductToProductSetRequest
google.cloud.vision.v1p4beta1.AnnotateFileRequest
google.cloud.vision.v1p4beta1.AnnotateFileResponse
google.cloud.vision.v1p4beta1.AnnotateImageRequest
google.cloud.vision.v1p4beta1.AnnotateImageResponse
google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest
google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse
google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest
google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse
google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest
google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse
google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest
google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse
google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest
google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse
google.cloud.vision.v1p4beta1.BatchOperationMetadata
google.cloud.vision.v1p4beta1.Block
google.cloud.vision.v1p4beta1.BlockType
google.cloud.vision.v1p4beta1.BoundingPoly
google.cloud.vision.v1p4beta1.BreakType
google.cloud.vision.v1p4beta1.ColorInfo
google.cloud.vision.v1p4beta1.CreateProductRequest
google.cloud.vision.v1p4beta1.CreateProductSetRequest
google.cloud.vision.v1p4beta1.CreateReferenceImageRequest
google.cloud.vision.v1p4beta1.CropHint
google.cloud.vision.v1p4beta1.CropHintsAnnotation
google.cloud.vision.v1p4beta1.CropHintsParams
google.cloud.vision.v1p4beta1.DeleteProductRequest
google.cloud.vision.v1p4beta1.DeleteProductSetRequest
google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest
google.cloud.vision.v1p4beta1.DetectedBreak
google.cloud.vision.v1p4beta1.DetectedLanguage
google.cloud.vision.v1p4beta1.DominantColorsAnnotation
google.cloud.vision.v1p4beta1.EntityAnnotation
google.cloud.vision.v1p4beta1.FaceAnnotation
google.cloud.vision.v1p4beta1.Feature
google.cloud.vision.v1p4beta1.GcsDestination
google.cloud.vision.v1p4beta1.GcsSource
google.cloud.vision.v1p4beta1.GetProductRequest
google.cloud.vision.v1p4beta1.GetProductSetRequest
google.cloud.vision.v1p4beta1.GetReferenceImageRequest
google.cloud.vision.v1p4beta1.GroupedResult
google.cloud.vision.v1p4beta1.Image
google.cloud.vision.v1p4beta1.ImageAnnotationContext
google.cloud.vision.v1p4beta1.ImageContext
google.cloud.vision.v1p4beta1.ImageProperties
google.cloud.vision.v1p4beta1.ImageSource
google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource
google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig
google.cloud.vision.v1p4beta1.ImportProductSetsRequest
google.cloud.vision.v1p4beta1.ImportProductSetsResponse
google.cloud.vision.v1p4beta1.InputConfig
google.cloud.vision.v1p4beta1.KeyValue
google.cloud.vision.v1p4beta1.Landmark
google.cloud.vision.v1p4beta1.LatLongRect
google.cloud.vision.v1p4beta1.Likelihood
google.cloud.vision.v1p4beta1.ListProductSetsRequest
google.cloud.vision.v1p4beta1.ListProductSetsResponse
google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest
google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse
google.cloud.vision.v1p4beta1.ListProductsRequest
google.cloud.vision.v1p4beta1.ListProductsResponse
google.cloud.vision.v1p4beta1.ListReferenceImagesRequest
google.cloud.vision.v1p4beta1.ListReferenceImagesResponse
google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation

v1.ProductSearchClient

v1p3beta1.ProductSearchClient

v1p4beta1.ProductSearchClient