# svg2png-converter

> SVG to PNG converter

Latest version **1.0.2** (published 2021-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install svg2png-converter
pnpm add svg2png-converter
yarn add svg2png-converter
bun add svg2png-converter
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-01-24 |
| First published | 2020-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Maksim mdbel |
| Maintainers | mdbel |
| Keywords | SVG, PNG, SVG to PNG |

## Links

- npm: https://www.npmjs.com/package/svg2png-converter
- Repository: https://github.com/mdbel/svg2png
- Homepage: https://github.com/mdbel/svg2png#readme
- Issues: https://github.com/mdbel/svg2png/issues
- npm.io page: https://npm.io/package/svg2png-converter

## Recent versions

- 1.0.2 (latest) — 2021-01-24
- 1.0.1 — 2020-10-05
- 1.0.0 — 2020-08-01
- 0.0.5 — 2020-04-26
- 0.0.4 — 2020-04-26
- 0.0.3 — 2020-04-26
- 0.0.2 — 2020-04-25
- 0.0.1 — 2020-04-25

## README

# svg2png
Lightweight TypeScript SVG to PNG converter.
## Usage
If you want to generate a PNG dataURI, you can call **Svg2Png.toDataURL(source, options)**, which returns a Promise.
As a source you can use an SVG element or a selector that refers to an element in DOM. 
If you want to download your SVG as PNG, you can call **Svg2Png.save(source, name, options)**
## Installation
To install with npm:
```bash
npm i svg2png-converter
```
## Examples


```typescript
import {Svg2Png} from 'svg2png-converter';

const svg = document.querySelector('svg');
const options = {
    scaleX: 2,
    scaleY: 2
};

Svg2Png.toDataURL(svg, options).then(url => {
    document.querySelector('img').setAttribute('src', url);
});
```

```typescript
import {Svg2Png} from 'svg2png-converter';

Svg2Png.save('svg', 'icon');
```

### Options

Please note that all options are optional.

| Option               | Default value                      |
| -------------------- | ---------------------------------- | 
| `scaleX`             | 1                                  | 
| `scaleY`             | 1                                  |
| `embedCSS`           | true                               |

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