---
title: "Convert image to text with JavaScript library | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/web/conversion/image-to-text/"
md_url: "https://www.nutrient.io/guides/web/conversion/image-to-text.md"
last_updated: "2026-06-09T10:14:07.143Z"
description: "Convert image to text with JavaScript library | guide for Nutrient Web SDK with detailed instructions and code examples."
---

# Convert images to text using JavaScript

You can convert images to text with Nutrient Web SDK.

Converting images to text is available when using [Web SDK](https://www.nutrient.io/guides/web.md) with [Document Engine](https://www.nutrient.io/guides/document-engine.md). For more information, refer to the [operational mode](https://www.nutrient.io/guides/web/about/operational-modes.md) guide.








First, make sure to [open the image from Document Engine](https://www.nutrient.io/guides/web/open-a-document/from-document-engine.md).

This feature requires the Image Documents component to be enabled in your license.

Next, detect the text in the image by running the `performOcr` operation:

```js

await instance.applyOperations([
  { type: "performOcr", language: "english", pageIndexes: "all" }
]);

```

This feature requires the OCR component to be enabled in your license.

Then you can extract the text using the [`NutrientViewer.Instance#textLinesForPageIndex`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#textLinesForPageIndex) method:

```js

const textLines = await instance.textLineForPageIndex(0);

```

To log all text in the image on the console, you can then run:

```js

textLines.forEach((l) => console.log(l.contents));

```

## Other languages

You can extract text written in languages other than English using the `language` parameter:

```js

await instance.applyOperations([
  { type: "performOcr", language: "spanish", pageIndexes: "all" }
]);

```

Nutrient Web SDK supports the following languages:

- Croatian

- Czech

- Danish

- Dutch

- English

- Finnish

- French

- German

- Indonesian

- Italian

- Malay

- Norwegian

- Polish

- Portuguese

- Serbian

- Slovak

- Slovenian

- Spanish

- Swedish

- Turkish

- Welsh
---

## Related pages

- [Convert images to PDFs using JavaScript](/guides/web/conversion/image-to-pdf.md)
- [Headless file conversion](/guides/web/conversion/headless.md)
- [Convert PDFs to images using JavaScript](/guides/web/conversion/pdf-to-image.md)
- [JavaScript PDF conversion library](/guides/web/conversion.md)
- [Convert scanned PDFs to searchable PDFs using JavaScript](/guides/web/conversion/scan-to-searchable-pdf.md)
- [Convert PDF to Office using JavaScript](/guides/web/conversion/pdf-to-office.md)
- [Convert text to PDF using JavaScript](/guides/web/conversion/text-to-pdf.md)
- [Convert Office to PDF using JavaScript](/guides/web/conversion/office-to-pdf.md)
- [Convert PDFs and images to PDF/A using JavaScript](/guides/web/conversion/to-pdfa.md)

