GithubHelp home page GithubHelp logo

to-ico's Introduction

to-ico Build Status

Convert PNG to ICO in memory

Install

$ npm install --save to-ico

Usage

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 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 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
Default: false

Use the largest image and resize to sizes defined using the sizes option.

sizes

Type: Array
Default: [16, 24, 32, 48, 64, 128, 256]

Array of sizes to use when resizing.

Related

License

MIT © Kevin Martensson

to-ico's People

Contributors

kevva avatar gianluca-nitti avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.