Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@google-cloud/vision

googleapis355.2kApache-2.04.3.3TypeScript support: included

Google Cloud Vision API client for Node.js

google apis client, google api client, google apis, google api, google, google cloud platform, google cloud, cloud, google vision, vision, Google Cloud Vision API

readme

Google Cloud Platform logo

Google Cloud Vision API: Node.js Client

release level npm version

Google Cloud Vision API client for Node.js

A comprehensive list of changes in each version may be found in the CHANGELOG.

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 so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/vision

Samples

Samples are in the samples/ directory. Each sample's README.md has instructions for running its sample.

Sample Source Code Try it
Image_annotator.async_batch_annotate_files source code Open in Cloud Shell
Image_annotator.async_batch_annotate_images source code Open in Cloud Shell
Image_annotator.batch_annotate_files source code Open in Cloud Shell
Image_annotator.batch_annotate_images source code Open in Cloud Shell
Product_search.add_product_to_product_set source code Open in Cloud Shell
Product_search.create_product source code Open in Cloud Shell
Product_search.create_product_set source code Open in Cloud Shell
Product_search.create_reference_image source code Open in Cloud Shell
Product_search.delete_product source code Open in Cloud Shell
Product_search.delete_product_set source code Open in Cloud Shell
Product_search.delete_reference_image source code Open in Cloud Shell
Product_search.get_product source code Open in Cloud Shell
Product_search.get_product_set source code Open in Cloud Shell
Product_search.get_reference_image source code Open in Cloud Shell
Product_search.import_product_sets source code Open in Cloud Shell
Product_search.list_product_sets source code Open in Cloud Shell
Product_search.list_products source code Open in Cloud Shell
Product_search.list_products_in_product_set source code Open in Cloud Shell
Product_search.list_reference_images source code Open in Cloud Shell
Product_search.purge_products source code Open in Cloud Shell
Product_search.remove_product_from_product_set source code Open in Cloud Shell
Product_search.update_product source code Open in Cloud Shell
Product_search.update_product_set source code Open in Cloud Shell
Image_annotator.batch_annotate_images source code Open in Cloud Shell
Image_annotator.async_batch_annotate_files source code Open in Cloud Shell
Image_annotator.batch_annotate_images source code Open in Cloud Shell
Image_annotator.async_batch_annotate_files source code Open in Cloud Shell
Image_annotator.batch_annotate_images source code Open in Cloud Shell
Product_search.add_product_to_product_set source code Open in Cloud Shell
Product_search.create_product source code Open in Cloud Shell
Product_search.create_product_set source code Open in Cloud Shell
Product_search.create_reference_image source code Open in Cloud Shell
Product_search.delete_product source code Open in Cloud Shell
Product_search.delete_product_set source code Open in Cloud Shell
Product_search.delete_reference_image source code Open in Cloud Shell
Product_search.get_product source code Open in Cloud Shell
Product_search.get_product_set source code Open in Cloud Shell
Product_search.get_reference_image source code Open in Cloud Shell
Product_search.import_product_sets source code Open in Cloud Shell
Product_search.list_product_sets source code Open in Cloud Shell
Product_search.list_products source code Open in Cloud Shell
Product_search.list_products_in_product_set source code Open in Cloud Shell
Product_search.list_reference_images source code Open in Cloud Shell
Product_search.remove_product_from_product_set source code Open in Cloud Shell
Product_search.update_product source code Open in Cloud Shell
Product_search.update_product_set source code Open in Cloud Shell
Image_annotator.async_batch_annotate_files source code Open in Cloud Shell
Image_annotator.async_batch_annotate_images source code Open in Cloud Shell
Image_annotator.batch_annotate_files source code Open in Cloud Shell
Image_annotator.batch_annotate_images source code Open in Cloud Shell
Product_search.add_product_to_product_set source code Open in Cloud Shell
Product_search.create_product source code Open in Cloud Shell
Product_search.create_product_set source code Open in Cloud Shell
Product_search.create_reference_image source code Open in Cloud Shell
Product_search.delete_product source code Open in Cloud Shell
Product_search.delete_product_set source code Open in Cloud Shell
Product_search.delete_reference_image source code Open in Cloud Shell
Product_search.get_product source code Open in Cloud Shell
Product_search.get_product_set source code Open in Cloud Shell
Product_search.get_reference_image source code Open in Cloud Shell
Product_search.import_product_sets source code Open in Cloud Shell
Product_search.list_product_sets source code Open in Cloud Shell
Product_search.list_products source code Open in Cloud Shell
Product_search.list_products_in_product_set source code Open in Cloud Shell
Product_search.list_reference_images source code Open in Cloud Shell
Product_search.purge_products source code Open in Cloud Shell
Product_search.remove_product_from_product_set source code Open in Cloud Shell
Product_search.update_product source code Open in Cloud Shell
Product_search.update_product_set source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell

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

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, and can be installed through npm dist-tags. The dist-tags follow the naming convention legacy-(version). For example, npm install @google-cloud/vision@legacy-8 installs client libraries for versions compatible with Node.js 8.

Versioning

This library follows Semantic Versioning.

This library is considered to be stable. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against stable libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

Please note that this README.md, the samples/README.md, and a variety of configuration files in this repository (including .nycrc and tsconfig.json) are generated from a central template. To edit one of these files, make an edit to its templates in directory.

License

Apache Version 2.0

See LICENSE

changelog

Changelog

npm history

4.3.3 (2025-02-12)

Bug Fixes

  • [Many APIs] finalize fixing typings for headers in generator (#6019) (734397c)

4.3.2 (2024-08-19)

Bug Fixes

4.3.1 (2024-08-09)

Bug Fixes

4.3.0 (2024-05-21)

Features

  • [Many APIs] update Nodejs generator to send API versions in headers for GAPICs (#5351) (01f48fc)
  • [Many APIs] update Nodejs generator to send API versions in headers for GAPICs (#5354) (a9784ed)

4.2.1 (2024-04-16)

Bug Fixes

4.2.0 (2024-03-29)

Features

  • [Many APIs] add several fields to manage state of database encryption update (#5192) (b926f13)

4.1.0 (2024-02-09)

Features

  • Trusted Private Cloud support, use the universeDomain parameter (#5018) (3180809)

4.0.3 (2024-01-23)

Bug Fixes

  • [Many APIs] improve retry logic for streaming API calls (#4968) (7fbf16c)

4.0.2 (2023-09-06)

Bug Fixes

  • [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4588) (e5ad564)
  • deps: Update dependency @google-cloud/promisify to v4 (#4533) (58950c9)
  • deps: Update dependency pureimage to ^0.4.0 (#4550) (338ba13)

4.0.1 (2023-08-09)

Bug Fixes

  • deps: Update dependency @google-cloud/promisify to v4 (#4520) (e0e9343)

4.0.0 (2023-08-06)

⚠ BREAKING CHANGES

  • migrate to Node 14 (#4443)

Bug Fixes

Miscellaneous Chores

3.1.4 (2023-06-28)

Bug Fixes

3.1.3 (2023-04-13)

Bug Fixes

3.1.2 (2023-02-15)

Bug Fixes

  • [Many APIs] changing format of the jsdoc links (#3990) (878c55d)

3.1.1 (2023-01-28)

Bug Fixes

3.1.0 (2023-01-14)

Features

Bug Fixes

3.0.1 (2022-09-21)

Bug Fixes

  • Preserve default values in x-goog-request-params header (#1044) (a5baeca)

3.0.0 (2022-09-01)

⚠ BREAKING CHANGES

  • Update library to use Node 12 (#1016)
  • BatchAnnotateImagesRequest.requests is required (#1011)

Features

Bug Fixes

Build System

2.4.2 (2022-01-06)

Bug Fixes

2.4.1 (2021-12-14)

Bug Fixes

2.4.0 (2021-09-09)

Features

  • turns on self-signed JWT feature flag (#942) (c0558c7)

Bug Fixes

2.3.8 (2021-08-17)

Bug Fixes

2.3.7 (2021-07-21)

Bug Fixes

  • Updating WORKSPACE files to use the newest version of the Typescript generator. (#928) (f5cddc5)

2.3.6 (2021-07-12)

Bug Fixes

2.3.5 (2021-06-29)

Bug Fixes

2.3.4 (2021-06-22)

Bug Fixes

2.3.3 (2021-05-26)

Bug Fixes

  • GoogleAdsError missing using generator version after 1.3.0 (#908) (3bd4071)

2.3.2 (2021-05-12)

Bug Fixes

2.3.1 (2021-02-18)

Bug Fixes

  • deps: update dependency natural to v3 (#865) (38d9a1a)
  • deps: update dependency natural to v4 (#870) (edfcb9e)
  • sync vision v1 protos to get extra FaceAnnotation Landmark Types (#868) (4d45375)

2.3.0 (2021-01-06)

Features

  • introduce style enumeration (b5fe1ac)

2.2.0 (2021-01-06)

Features

  • Add TextDetectionParams.enable_text_detection_confidence_score (#850) (c8f51a2)

Bug Fixes

  • browser: check for fetch on window (ef95fb1)
  • do not modify options object, use defaultScopes (#845) (8377b42)

2.1.2 (2020-09-12)

Bug Fixes

  • deps: update dependency yargs to v16 (#824) (9ce5215)

2.1.1 (2020-07-10)

Bug Fixes

2.1.0 (2020-06-12)

Features

  • secrets: begin migration to secret manager from keystore (#790) (4d9e334)
  • switch to es2018 target for TypeScript (#788) (7df91d4)

Bug Fixes

2.0.0 (2020-06-04)

⚠ BREAKING CHANGES

  • The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM.

Features

  • check status of long running operation by its name (#773) (2b3becf)
  • drop node8 support, support for async iterators (#568) (e2dccd0)

Bug Fixes

  • deps: update dependency @google-cloud/promisify to v2 (#565) (c71a709)
  • deps: update dependency mathjs to v7 (#775) (d64d99f)
  • deps: update dependency natural to v1 (#768) (44a8dcc)
  • deps: update dependency natural to v2 (#772) (afdc8da)
  • samples: use pureimage instead of canvas (#774) (a352338)
  • mocha tests (#784) (319c98e)
  • remove eslint, update gax, fix generated protos, run the generator (#756) (72f22b6)

1.11.0 (2020-03-11)

Features

1.10.0 (2020-03-03)

Features

  • move API to typescript code generation (#532) (401e694)

1.9.0 (2020-02-10)

Features

Bug Fixes

1.8.0 (2020-01-02)

Features

  • add new resource descriptors (#491) (95037bf)
  • samples: add sample of configuring alternate apiEndpoint (#473) (fa01482)

Bug Fixes

  • deps: TypeScript 3.7.0 causes breaking change in typings (#497) (30aa9ff)

1.7.2 (2019-11-18)

Bug Fixes

  • deps: update dependency yargs to v15 (#488) (21c889e)

1.7.1 (2019-11-13)

Bug Fixes

  • import long in proto ts declaration file (#482) (1f5258b)
  • docs: snippets are now replaced in jsdoc comments (#481) (07281d6)

1.7.0 (2019-11-08)

Features

1.6.0 (2019-11-05)

Features

  • added endpoint samples for vision api (#467) (4c569b4)

Bug Fixes

Reverts

  • added endpoint samples for vision api (ea5d421)

1.5.0 (2019-10-10)

Bug Fixes

  • update protobuf options for product sets (#462) (32b3fa9)
  • use compatible version of google-gax (a4f2863)

Features

1.4.0 (2019-09-14)

Features

  • make vision helpers work with JSON proto (#441) (5b7a249)

1.3.0 (2019-09-09)

Bug Fixes

  • use process versions object for client header (#428) (c1dde85)
  • samples: upgrade yargs and fix broken CLI config (#436) (1a9c374)

Features

  • load protos from JSON, grpc-fallback support (9914445)

1.2.0 (2019-08-19)

Features

  • adds support for multiple regions (244e21e)

1.1.4 (2019-08-05)

Bug Fixes

  • allow calls with no request, add JSON proto (55c0380)

1.1.3 (2019-06-26)

Bug Fixes

  • docs: link to reference docs section on googleapis.dev (#406) (fa2fb3f)

1.1.2 (2019-06-15)

Bug Fixes

1.1.1 (2019-06-11)

Bug Fixes

  • deps: update dependency mathjs to v6 (#399) (6c37196)

1.1.0 (2019-06-05)

Features

  • support apiEndpoint override in client constructor (#393) (7777275)

1.0.0 (2019-05-13)

Bug Fixes

  • deps: update dependency google-gax to v1 (#376) (14a5ca9)
  • DEADLINE_EXCEEDED is idempotent (#377) (d7ed2d3)
  • deps: update dependency @google-cloud/promisify to v1 (#367) (f1a5bcc)
  • deps: update dependency google-gax to ^0.26.0 (#362) (81a3379)
  • include 'x-goog-request-params' header in requests (4e7a1c6), closes #353
  • samples: make test assertion less specific (#354) (435ddf0)

Build System

Features

BREAKING CHANGES

  • upgrade engines field to >=8.10.0 (#363)

v0.25.0

02-22-2019 17:39 PST

New Features

This release contains a new version (v1p4beta1) of the Vision API. To use this version, construct the client liks this:

const vision = require('@google-cloud/vision');
const client = new vision.v1p4beta1.ImageAnnotatorClient();
  • feat: gen v1p4beta1: online PDF, async batch image annotate (#331)

Implementation Changes

  • fix: throw on invalid credentials in v1p4beta1 (#334)
  • fix: throw on invalid credentials (#326)

Dependencies

  • chore(deps): update dependency mocha to v6 (#330)
  • fix(deps): update dependency @google-cloud/promisify to ^0.4.0 (#328)
  • fix(deps): update dependency yargs to v13 (#325)
  • fix(deps): update dependency google-gax to ^0.25.0 (#315)
  • fix(deps): update dependency google-gax to ^0.24.0 (#312)
  • chore(deps): update dependency eslint-config-prettier to v4 (#313)
  • fix(deps): update dependency google-gax to ^0.23.0 (#307)

Documentation / Samples

  • docs: update contributing path in README (#321)
  • docs: update links in contrib guide (#329)
  • docs: add lint/fix example to contributing guide (#318)
  • docs: fix example comments (#317)
  • fix(docs): remove unused long running operations types
  • docs: improve detect.js samples (#300)

Internal / Testing Changes

  • build: use linkinator for docs test (#327)
  • build: create docs test npm scripts (#324)
  • build: test using @grpc/grpc-js in CI (#322)
  • chore: move CONTRIBUTING.md to root (#320)
  • refactor: improve generated code style. (#316)
  • fix: ignore case in system test assertions (#314)
  • build: ignore googleapis.com in doc link check (#310)
  • chore: update year in the license headers. (#309)
  • build: check broken links in generated docs (#301)

v0.24.0

12-19-2018 13:36 PST

Implementation Changes

This release contains breaking change

  • BREAKING: rename method imagePath => referenceImagePath (#296) The method ProductSearchClient.imagePath was renamed referenceImagePath: ` // old code const formattedName = client.imagePath(...);

// new code const formattedName = client.referenceImagePath(...); `

  • fix: Param "scoreThreshold" should be "score_threshold" (#234)

New Features

  • ProductSearch GA (#280)

Dependencies

  • refactor: remove unused deps (#261)
  • fix(deps): update dependency google-gax to ^0.22.0 (#265)
  • chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 (#263)
  • fix(deps): update dependency @google-cloud/vision to ^0.23.0 (#260)

Documentation

  • docs: fix productSearch example (#285)
  • docs: update readme badges (#283)
  • docs(samples): updated samples code to use async/await and tests to use mocha (#241)

Internal / Testing Changes

  • chore: modernize the samples and sample tests (#297)
  • chore(build): inject yoshi automation key (#294)
  • chore: update nyc and eslint configs (#293)
  • chore: fix publish.sh permission +x (#292)
  • fix(build): fix Kokoro release script (#291)
  • build: add Kokoro configs for autorelease (#290)
  • chore: always nyc report before calling codecov (#288)
  • chore: nyc ignore build/test by default (#287)
  • chore: update license file (#284)
  • fix(build): fix system key decryption (#282)
  • test: make product search tests run (#269)
  • chore: update eslintignore config (#264)
  • chore: drop contributors from multiple places (#262)

v0.23.0

New Features

  • feat: add support for product search

Dependencies

  • chore(deps): update dependency eslint-plugin-node to v8 (#245)
  • chore(deps): update dependency canvas to v2 (#224)
  • chore(deps): update dependency sinon to v7 (#219)
  • chore(deps): update dependency eslint-plugin-prettier to v3 (#213)

Documentation

  • fix(samples): Adding vision_product_search_tutorial_import tags (#221)
  • fix(samples): Change the Project ID from number to string (#220)
  • docs: Vision AutoML samples (#197)

Internal / Testing Changes

  • chore: use latest npm on Windows (#258)
  • chore: update lint configs (#257)
  • chore: update CircleCI config (#253)
  • chore: update issue templates (#244)
  • chore: remove old issue template (#242)
  • build: run tests on node11 (#239)
  • chores(build): do not collect sponge.xml from windows builds (#238)
  • chores(build): run codecov on continuous builds (#237)
  • chore: update new issue template (#235)
  • build: fix codecov uploading on Kokoro (#222)
  • chore: enable --throw-deprecation on mocha config (#147)
  • Update kokoro config (#214)
  • Update kokoro config (#208)
  • test: remove appveyor config (#207)
  • Update the CI config (#206)

v0.22.1

Bug fixes

  • Fix response output for Detect Labels (#199)

Documentation

  • Vision GA – vision_localize_objects & vision_localize_object_gcs (#200)
  • Product search rebased (#196)

Internal / Testing Changes

  • Enable prefer-const in the eslint config (#201)
  • Enable no-var in eslint (#198)
  • Switch to let/const (#194)
  • fix(deps): update dependency google-gax to ^0.20.0 (#193)

v0.22.0

New Features

Object Localization is available on v1 of this library:

  • Updated CI config and run synth (#181)

Dependencies

  • chore(deps): update dependency @google-cloud/storage to v2 (#183)
  • chore(deps): update dependency nyc to v13 (#177)
  • fix(deps): update dependency google-gax to ^0.19.0 (#173)
  • chore(deps): update dependency eslint-config-prettier to v3 (#170)

Internal / Testing Changes

  • Update CI config (#188)
  • Fix the sample tests (#187)
  • Retry npm install in CI (#185)
  • Update CI config (#184)
  • fix: (tests): Use real service to validate expectations. (#182)
  • chore: make the CircleCI config consistent
  • Udpate Beta Vision samples to use beta tags (#172)
  • Vision region tag update (#171)
  • build: configure Windows build on Kokoro (#165)
  • chore: do not use npm ci (#167)
  • build(kokoro): samples-test.sh need GCLOUD_PROJECT env; node6 and node8 is using wrong .sh (#162)
  • build(kokoro): setup samples and system test (#161)
  • chore: ignore package-lock.json (#160)
  • build: rename build.sh => test.sh; presubmit jobs runs lint and docs properly (#158)
  • fix(samples): missing fs requires causing sample-test to fail (#157)
  • build: add set -x to .sh to show the command being executed (#156)
  • add samples linking to kokoro jobs (#155)
  • Kokoro multi ver (#153)
  • chore: update renovate config (#152)
  • have presubmit.cfg in separate node* folders (#151)
  • split presubmit to multiple node versions (#149)

v0.21.1

Patch release to bring in updates to google-gax@0.18.0 so it no longer emits deprecation warnings with grpc (#120), along with other dependency updates and documentation changes.

Dependencies

  • fix(deps): update dependency google-gax to ^0.18.0 (#146)
  • chore: drop dependency on common (#134)
  • chore(deps): update dependency eslint-plugin-node to v7 (#127)

Documentation

  • Code Samples demonstrating Object Localization & Handwriting OCR (#133)

Internal / Testing Changes

  • build: initial kokoro setup (#145)
  • chore: assert.deelEqual => assert.deepStrictEqual (#143)
  • chore: move mocha options to mocha.opts (#141)
  • chore: require node 8 for samples (#142)
  • chore: add node templates to synth.py (#139)
  • fix(deps): update dependency @google-cloud/vision to ^0.21.0 (#131)

v0.21.0

Implementation Changes

🚨 BREAKING CHANGE

In this version we dropped support for NodeJS 4.x and 9.x. Your code might break if you're using this library on non LTS versions.

  • fix: drop support for node.js 4.x and 9.x (#117)

New Features

This release brings in v1p3beta1 of the Cloud Vision API, which includes the following new features:

  • Object localization
  • Product search

  • gen: v1p3beta1 of Cloud Vision API NodeJS Client Library (#124)

  • feat: implement manual methods for objectLocalization and productSearch on v1p3beta1 (#128)

Dependencies

  • fix: update and cleanup dependencies (#102)
  • fix(deps): update dependency yargs to v12 (#103)
  • repo: setup greenkeeper.json to update dependencies in samples/package.json (#94)
  • refactor: drop dependency on extend (#85)
  • fix: move async to dev dependencies (#83)
  • chore: update many dependencies (#81)
  • fix: switch from node-uuid to uuid (#84)
  • chore(package): update eslint to version 5.0.1 (#98)
  • chore(package): update eslint to version 5.0.0 (#90)

Documentation

Internal / Testing Changes

  • Add smoke tests via regeneration (#122)
  • Re-generate library using /synth.py (#111)
  • synth.py: follow synth scripts from other repos (#113)
  • Beta2ga pdf ocr (#104)
  • Configure Renovate (#87)
  • refactor: drop repo-tool as an exec wrapper (#97)
  • fix: update linking for samples (#92)