# png-to-ico

> convert png to windows ico format

Latest version **3.0.2** (published 2026-07-06) · MIT license · 0 weekly downloads

## Install

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

Provides the command `png-to-ico`.

## Health

**Score 60/100 (C)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2026-07-06 |
| First published | 2016-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 3 |
| Unpacked size | 23.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 179 |
| Author | Weilin Shi |
| Maintainers | steambap, lichaozhy |
| Keywords | png, ico, favicon, favicon-generator, fast, convert |

## Links

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

## Dependencies (3)

- [pngjs](https://npm.io/package/pngjs.md) ^7.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.8
- [@types/node](https://npm.io/package/@types/node.md) ^25.5.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

- 3.0.2 (latest) — 2026-07-06
- 3.0.1 — 2025-08-22
- 3.0.0 — 2025-08-20
- 2.1.8 — 2022-09-20
- 2.1.7 — 2022-08-30
- 2.1.6 — 2022-08-29
- 2.1.5 — 2022-08-22
- 2.1.4 — 2022-03-22
- 2.1.3 — 2022-03-10
- 2.1.2 — 2021-02-21
- 2.1.1 — 2020-10-09
- 2.1.0 — 2020-03-02
- 2.0.6 — 2019-10-23
- 2.0.5 — 2019-09-15
- 2.0.4 — 2019-07-16
- … 14 more at https://npm.io/package/png-to-ico/versions

## README

# png-to-ico

[![Build Status](https://github.com/steambap/png-to-ico/workflows/CI/badge.svg)](https://github.com/steambap/png-to-ico/actions?workflow=CI)

> convert png to windows ico format

## Translations
[中文](README_CN.md)

## intro
![image](assets/png-to-ico.gif)

## install
> npm install --save-dev png-to-ico

## usage
npm script:
```
png-to-ico electron.png > app.ico
```

npx script:
```
npx png-to-ico -- electron.png > app.ico
```
This way you can run the script without installing the package into your project

programming usage:
```JavaScript
import fs from 'fs';
import pngToIco from 'png-to-ico';

try {
  const buf = await pngToIco('electron.png');
  fs.writeFileSync('app.ico', buf);
} catch (error) {
  console.error(error);
}
```

If you want to control what sizes should be in the icon file, pass an array of files:
```JavaScript
const buf = await pngToIco(['electron16x16.png', 'electron32x32.png']);
fs.writeFileSync('app.ico', buf);
```

## Why use png-to-ico?
When I work on an electron project, it's always a nightmare to create ico for windows.  
There're so many options out there like apps that make icon for you, photoshop plugin. But none of them satisfy me.  
I want a JavaScript module that works like the .NET ico tool, which automatically generate different sizes for ico file.  

Based on [pngjs](https://github.com/lukeapage/pngjs):
Simple PNG encoder/decoder library written entirely in JavaScript for Node, with zero external or native dependencies.  
In other words, png-to-ico is written purely in JavaScript, which is great for windows user.  

## license
[MIT](LICENSE)

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