# text2image

> Create image from text

Latest version **1.2.1** (published 2021-03-30) · GPL-3.0 license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2021-03-30 |
| First published | 2020-11-09 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 349.3 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Nurutomo |
| Maintainers | nurutomo |
| Keywords | text, svg, image, converter, sharp |

## Links

- npm: https://www.npmjs.com/package/text2image
- Repository: https://github.com/Nurutomo/text2image
- Homepage: https://github.com/Nurutomo/text2image#readme
- Issues: https://github.com/Nurutomo/text2image/issues
- npm.io page: https://npm.io/package/text2image

## Dependencies (6)

- [jsdom](https://npm.io/package/jsdom.md) ^16.4.0
- [sharp](https://npm.io/package/sharp.md) ^0.26.2
- [points](https://npm.io/package/points.md) ^3.2.0
- [svg-points](https://npm.io/package/svg-points.md) ^6.0.1
- [emoji-regex](https://npm.io/package/emoji-regex.md) ^9.2.0
- [opentype.js](https://npm.io/package/opentype.js.md) ^1.3.3

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2021-03-30
- 1.1.3 — 2020-11-22
- 1.1.2 — 2020-11-22
- 1.1.1 — 2020-11-18
- 1.1.0 — 2020-11-18
- 1.0.4 — 2020-11-09
- 1.0.3 — 2020-11-09
- 1.0.2 — 2020-11-09
- 1.0.1 — 2020-11-09

## README

# text2image
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FNurutomo%2Ftext2image&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
-----------------------------------
Installation:
```
npm i text2image
```

Usage:
```js
const text2image = require('text2image')
```

Load font
```js
const font = text2image.loadFont('path/to/font.ttf')
```

Converting text to image
```js
// PNG
text2image.convert(font, 'Hello, World!', 0, 0, 72).then(buffer => {
    fs.writeFileSync('hello_world.png', buffer) // <Buffer 89 50 4e ...
})
 
// SVG
text2image.convert(font, 'Hello, World!', 0, 0, 72, { useSvg: true }).then(buffer => {
    fs.writeFileSync('hello_world.svg', buffer) // <Buffer 3c 73 76 ...
})
```

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