Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlyonsmith/ico2pngs
Extract bitmaps from an ICO file into separate PNG files with metadata
https://github.com/jlyonsmith/ico2pngs
Last synced: 6 days ago
JSON representation
Extract bitmaps from an ICO file into separate PNG files with metadata
- Host: GitHub
- URL: https://github.com/jlyonsmith/ico2pngs
- Owner: jlyonsmith
- License: mit
- Created: 2020-09-13T21:01:33.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-13T07:53:33.000Z (about 4 years ago)
- Last Synced: 2023-09-20T00:22:49.513Z (about 1 year ago)
- Language: JavaScript
- Size: 95.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ico2pngs
Extract the bitmaps from a `.ico` file and convert them to `.png` files.
## Highlights
- Converts each image in the `.ico` file into `.png` data
- Returns png data in a buffer, width, height & bits per pixel
- Works in Node.js and in a browser## Install
```sh
npm install @johnls/ico2pngs
```## Usage
In Node.js:
```js
import { ico2pngs } from "ico2pngs"
import fsPromise from "fs/promises";(async function () {
var buf = await fsPromise.readFile("test/favicon.ico")
var pngs = ico2pngs(buf.buffer)console.log(
`width: ${pngs[0].width}, height: ${pngs[0].height}, bitsPerPixel: ${pngs[0].bitsPerPixel}`
)
await fsPromise.writeFile("scratch/favicon0.png", pngs[0].pngData)
})()
```