Skip to content

Latest commit

 

History

History
95 lines (61 loc) · 3.85 KB

image-analysis-node-sdk-40.md

File metadata and controls

95 lines (61 loc) · 3.85 KB
title description author manager ms.service ms.topic ms.date ms.author
Quickstart: Image Analysis 4.0 client SDK for Node.js
Get started with the Image Analysis 4.0 client SDK for Node.js with this quickstart
PatrickFarley
nitinme
azure-ai-vision
include
01/15/2024
pafarley

Use the Image Analysis client SDK for JavaScript to analyze an image to read text and generate an image caption. This quickstart analyzes a remote image and prints the results to the console.

Reference documentation | Package (npm) | Samples

Tip

The Analysis 4.0 API can do many different operations. See the Analyze Image how-to guide for examples that showcase all of the available features.

Prerequisites

  • An Azure subscription - Create one for free
  • The current version of Node.js
  • The current version of Edge, Chrome, Firefox, or Safari internet browser.
  • Once you have your Azure subscription, create a Computer Vision resource in the Azure portal to get your key and endpoint. In order to use the captioning feature in this quickstart, you must create your resource in one of the supported Azure regions (see Image captions for the list of regions). After it deploys, select Go to resource.
    • You need the key and endpoint from the resource you create to connect your application to the Azure AI Vision service.
    • You can use the free pricing tier (F0) to try the service, and upgrade later to a paid tier for production.

[!INCLUDE create environment variables]

Analyze image

  1. Create a new Node.js application

    In a console window (such as cmd, PowerShell, or Bash), create a new directory for your app, and navigate to it.

    mkdir myapp && cd myapp

    Run the npm init command to create a node application with a package.json file.

    npm init
  2. Install the client library

    Install @azure-rest/ai-vision-image-analysis npm package:

    npm install @azure-rest/ai-vision-image-analysis

    Also install the dotenv package:

    npm install dotenv

    Your app's package.json file will be updated with the dependencies.

  3. Create a new file, index.js. Open it in a text editor and paste in the following code.

    [!code-javascript]

  4. Run the application with the node command on your quickstart file.

    node index.js

Clean up resources

If you want to clean up and remove an Azure AI services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with it.

Next steps

In this quickstart, you learned how to install the Image Analysis client library and make basic image analysis calls. Next, learn more about the Analyze API features.

[!div class="nextstepaction"] Call the Analyze API