# to-ico

> Convert PNG to ICO in memory

Latest version **1.1.5** (published 2017-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install to-ico
pnpm add to-ico
yarn add to-ico
bun add to-ico
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2017-08-15 |
| First published | 2016-04-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/to-ico) |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 137 |
| Author | Kevin Martensson |
| Maintainers | kevva |
| Keywords | buffer, convert, fast, ico, png |

## Links

- npm: https://www.npmjs.com/package/to-ico
- Repository: https://github.com/kevva/to-ico
- Homepage: https://github.com/kevva/to-ico#readme
- Issues: https://github.com/kevva/to-ico/issues
- npm.io page: https://npm.io/package/to-ico

## Dependencies (5)

- [arrify](https://npm.io/package/arrify.md) ^1.0.1
- [parse-png](https://npm.io/package/parse-png.md) ^1.0.0
- [image-size](https://npm.io/package/image-size.md) ^0.5.0
- [resize-img](https://npm.io/package/resize-img.md) ^1.1.0
- [buffer-alloc](https://npm.io/package/buffer-alloc.md) ^1.1.0

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 1.1.5 (latest) — 2017-08-15
- 1.1.4 — 2017-05-23
- 1.1.3 — 2016-10-31
- 1.1.2 — 2016-09-19
- 1.1.1 — 2016-09-19
- 1.1.0 — 2016-09-14
- 1.0.1 — 2016-04-18
- 1.0.0 — 2016-04-18

## README

# to-ico [![Build Status](https://travis-ci.org/kevva/to-ico.svg?branch=master)](https://travis-ci.org/kevva/to-ico)

> Convert PNG to ICO in memory


## Install

```
$ npm install --save to-ico
```


## Usage

```js
const fs = require('fs');
const toIco = require('to-ico');

const files = [
	fs.readFileSync('unicorn-16x16.png'),
	fs.readFileSync('unicorn-32x32.png')
];

toIco(files).then(buf => {
	fs.writeFileSync('favicon.ico', buf);
});
```


## API

### toIco(input, [options])

#### input

Type: `Array` `string`

Array of PNG image buffers.

The images must have a size of `16x16`, `24x24`, `32x32`, `48x48`, `64x64`, `128x128` or `256x256` and they must have an 8 bit per sample (channel) bit-depth (on Unix you can check this with the `file` command: RGB(A) is supported, while [colormap](https://en.wikipedia.org/wiki/Indexed_color) is not, because it's 8 bits per pixel instead of 8 bits per channel, which is 24 or 32 bits per pixel depending on the presence of the alpha channel). These are limitations in the underlying [`pngjs`](https://github.com/lukeapage/pngjs#pngjs) library. If you have a colormap PNG you can convert it to an RGB/RGBA PNG with commonly used image editing tools.

#### options

##### resize

Type: `boolean`<br>
Default: `false`

Use the largest image and resize to sizes defined using the [sizes](#sizes) option.

##### sizes

Type: `Array`<br>
Default: `[16, 24, 32, 48, 64, 128, 256]`

Array of sizes to use when resizing.


## Related

* [to-ico-cli](https://github.com/kevva/to-ico-cli) - CLI for this module


## License

MIT © [Kevin Martensson](http://github.com/kevva)

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