# @icon-magic/svg-to-png

> Icon magic blueprint package.

Latest version **2.6.0-beta.0** (published 2021-12-17) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install @icon-magic/svg-to-png
pnpm add @icon-magic/svg-to-png
yarn add @icon-magic/svg-to-png
bun add @icon-magic/svg-to-png
```

## 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 | 2.6.0-beta.0 |
| Published | 2021-12-17 |
| First published | 2019-07-31 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 180.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adam Miller |
| Maintainers | thegilby, camario25, epicmiller, rchitloor, omayeli |

## Links

- npm: https://www.npmjs.com/package/@icon-magic/svg-to-png
- npm.io page: https://npm.io/package/@icon-magic/svg-to-png

## Dependencies (6)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [puppeteer](https://npm.io/package/puppeteer.md) ^13.0.0
- [@types/fs-extra](https://npm.io/package/@types/fs-extra.md) ^8.0.0
- [@types/puppeteer](https://npm.io/package/@types/puppeteer.md) ^3.0.0
- [@icon-magic/logger](https://npm.io/package/@icon-magic/logger.md) ^2.3.0-beta.0

## Recent versions

- 2.6.0-beta.0 (latest) — 2021-12-17
- 2.8.1-beta.0 (beta) — 2022-04-15
- 2.7.0-beta.0 — 2021-12-22
- 2.5.0-beta.0 — 2021-11-03
- 2.3.0-beta.0 — 2021-07-27
- 2.2.9-beta.0 — 2021-07-14
- 2.2.8-beta.0 — 2021-05-04
- 2.2.6-beta.0 — 2020-08-20
- 2.2.3-beta.0 — 2019-11-12
- 2.2.2-beta.0 — 2019-10-30
- 2.2.1-beta.0 — 2019-10-14
- 2.2.0-beta.0 — 2019-09-16
- 2.0.1-beta.0 — 2019-07-31

## README

# @icon-magic/svg-to-png

Quickly converts an SVG file to a PNG file using Puppeteer. On process start, it spins up `os.cpus() - 1` independent browser instances to farm conversion tasks out across multiple processes. Exports two main methods:

## async convertFile(fileName: string, options: SVGToPNGOptions): Promise<Buffer>

Given a path to a file, return the PNG buffer of the converted image.

## async convert(contents: string, options: SVGToPNGOptions): Promise<Buffer>

Given the contents of a SVG file, return the PNG buffer of the converted image.

## Options

Conversion options use the following interface:

```typescript
interface SVGToPNGOptions {
  width: number; // Width of the output PNG.
  height: number; // Height of the output PNG.
  headless?: boolean; // If the browser converting the image should be headless or not. Useful for debugging.
}
```

---
_Source: https://npm.io/package/@icon-magic/svg-to-png · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
