# textifyimage

> textifyimage is a lightweight npm package that allows you to extract text from images effortlessly.

Latest version **1.0.3** (published 2023-07-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install textifyimage
pnpm add textifyimage
yarn add textifyimage
bun add textifyimage
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-07-12 |
| First published | 2023-07-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 22.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Johar Khan |
| Maintainers | joharkhan |
| Keywords | OCR, Image, to, text, text, extraction, text, recognition, Image, OCR |

## Links

- npm: https://www.npmjs.com/package/textifyimage
- Repository: https://github.com/joharkhan99/TextifyImage
- Homepage: https://github.com/joharkhan99/TextifyImage#readme
- Issues: https://github.com/joharkhan99/TextifyImage/issues
- npm.io page: https://npm.io/package/textifyimage

## Dependencies (2)

- [canvas](https://npm.io/package/canvas.md) ^2.11.2
- [tesseract.js](https://npm.io/package/tesseract.js.md) ^4.1.1

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-07-12
- 1.0.2 — 2023-07-08
- 1.0.0 — 2023-07-08

## README

# TextifyImage

TextifyImage is a JavaScript package that allows you to extract text from images using OCR (Optical Character Recognition) technology.

## Installation

You can install the package using npm:

```bash
npm install textifyimage
```

## Usage

To use the TextifyImage package, follow these steps:

## Image to Text (Extract text from image)

1. Import the `extractTextFromImage` function from the package:

2. Call the `extractTextFromImage` function, passing the file path or URL of the image as a parameter. The function returns a promise:

```javascript
import { extractTextFromImage } from "textifyimage";
```

```javascript
var text = extractTextFromImage("test.jpg");
```

3. Handle the promise using `then` and `catch` to access the extracted text or handle any errors:

```javascript
text
  .then((data) => {
    console.log(data); // Output the extracted text
  })
  .catch((error) => {
    console.log(error); // Handle any errors
  });
```

Please note that the `extractTextFromImage` function returns a promise, which allows you to handle the result asynchronously.

## Image to Text (Extract text from image)

2. Call the `convertTextToImage` function, passing desired parameters. The function returns a promise:

```javascript
import { convertTextToImage } from "textifyimage";
```

3. Handle the promise using `then` and `catch` to access the extracted text or handle any errors:

```javascript
const text = "Hello, World Text!";
const outputPath = "output.png";

// returns a callback. handle it with then and catch
convertTextToImage({
  text,
  outputPath,
  fontSize: "30px",
  fontName: "Arial",
  textColor: "rgb(0,0,0)",
  backgroundColor: "orange",
  width: 200,
  height: 200,
  lineHeight: 30,
  textAlignment: "start",
  x: 0,
  y: 30,
})
  .then(() => {
    console.log(`Image saved to ${outputPath}`);
  })
  .catch((error) => {
    console.error("Error:", error);
  });
```

#### Output

<img src="output.png" alt="output.png" />

Please note that the `convertTextToImage` function returns a promise, which allows you to handle the result asynchronously.

## License

This package is licensed under the ISC License.

---
_Source: https://npm.io/package/textifyimage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
