to-ico-sync

1.0.6 • Public • Published

to-ico-sync Build Status

This is a fork of https://github.com/kevva/to-ico that uses a simple synchronous function instead of promises, useful for node-based cli scripts.

Install

$ npm install --save to-ico-sync

Usage

const fs = require('fs');
const toIco = require('to-ico-sync');
 
const files = [
    fs.readFileSync('unicorn-16x16.png'),
    fs.readFileSync('unicorn-32x32.png')
];
 
var buf = toIco(files);
 
fs.writeFileSync('favicon.ico', buf);
 

API

toIco(input)

input

Type: array

An 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 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). Also, interlaced PNGs aren't supported. These are limitations in the underlying pngjs library. If you have a colormap PNG you can convert it to an RGB/RGBA PNG with commonly used image editing tools.

License

MIT licensed. Copyright for portions of source code are held by Kevin Martensson as part of module to-ico.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.6
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.6
    0
  • 1.0.5
    1

Package Sidebar

Install

npm i to-ico-sync

Weekly Downloads

1

Version

1.0.6

License

MIT

Last publish

Collaborators

  • gianluca-nitti