Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yeonjuan/2ico
Generate ico from canvas
https://github.com/yeonjuan/2ico
canvas favicon ico
Last synced: 2 days ago
JSON representation
Generate ico from canvas
- Host: GitHub
- URL: https://github.com/yeonjuan/2ico
- Owner: yeonjuan
- License: mit
- Created: 2021-09-09T07:09:45.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-12T14:06:06.000Z (about 3 years ago)
- Last Synced: 2024-10-12T17:41:35.674Z (about 1 month ago)
- Topics: canvas, favicon, ico
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 2ico
Generate ICO from canvas. see [Demo](https://yeonjuan.github.io/2ico/)
## Installation
```
npm install 2ico
```## Usage
```js
import toICO from '2ico';toICO(canvas, [16, 32, 48]); // data:image/x-icon;base64, ...
```### Parameters
- **canvas** (`HTMLCanvasElement`): The canvas element.
- **sizes** (`number[]`): The sizes of images in ico. (default: [16, 32, 48])### Returns
- Data URIs (`string`): the ico Data URIs.
```js
const elCanvas = document.getElementById('canvas-id');const result = toICO(
elCanvas,
[16, 32, 48]
);console.log(result); // data:image/x-icon;base64, ...
```## LICENSE
[MIT](./LICENSE)