Giter Site home page Giter Site logo

npm-icon-gen's Introduction

npm-icon-gen

npm version Build Status Document

Generate an icon files from the SVG or PNG files.

Support formats

Supported the output format of the icon are following.

Platform Icon
Windows app.ico
OS X app.icns
Favicon favicon.ico, favicon-XX.png

Installation

$ npm install icon-gen

Usage

SVG

SVG files are rendering to PNG file in svg2png. Rendering files is output to a temporary directory of the each OS.

Rendering of svg2png is run by phantomjs. Please use the PNG directory If the rendering quality there is a problem.

const icongen = require( 'icon-gen' );

icongen( './sample.svg', './dist', { report: true } )
.then( ( results ) => {
  console.log( results );
} )
.catch( ( err ) => {
  console.error( err );
} );

PNG

Generate an icon files from the directory of PNG files.

const icongen = require( 'icon-gen' );

icongen( './images', './dist', { type: 'png', report: true } )
.then( ( results ) => {
  console.log( results );
} )
.catch( ( err ) => {
  console.error( err );
} );

Required PNG files is below. Favicon outputs both the ICO and PNG files ( see: audreyr/favicon-cheat-sheet ).

Name Size ICO ICNS Fav ICO Fav PNG
16.png 16x16
24.png 24x24
32.png 32x32
48.png 48x48
57.png 57x57
64.png 64x64
72.png 72x72
96.png 96x96
120.png 120x120
128.png 128x128
144.png 144x144
152.png 152x152
195.png 195x195
228.png 228x228
256.png 256x256
512.png 512x512
1024.png 1024x1024

Node API

icongen

icongen is promisify function.

icongen( src, dest, [options] )
Name Type Description
src String Path of the SVG file or PNG files directory that becomes the source.
dest String Destination directory path.
options Object Options.

Options:

Name Type Description
type String Type of input file. Allowed value is a svg or png. 'svg' is SVG file, png is PNG files directory. Default is png.
modes Array Mode of output files. Allow value is a ico, icns, favicon and all. Default is all.
report Boolean Display the process reports. Default is false, disable a report.

CLI

Usage: icon-gen [OPTIONS]

  Generate an icon from the SVG or PNG file.

  Options:
    -h, --help    Display this text.

    -v, --version Display the version number.

    -i, --input   Path of the SVG file or PNG file directory.

    -o, --output  Path of the output directory.

    -t, --type    Type of the input file.
                  'svg' is the SVG file, 'png' is the PNG files directory.
                  Allowed values: svg, png
                  Default is 'svg'.

    -m, --modes   Mode of the output files.
                  Allowed values: ico, icns, favicon, all
                  Default is 'all'.

    -r, --report  Display the process reports.
                  Default is disable.

  Examples:
    $ icon-gen -i sample.svg -o ./dist -r
    $ icon-gen -i ./images -o ./dist -t png -r
    $ icon-gen -i sample.svg -o ./dist -m ico,favicon -r

  See also:
    https://github.com/akabekobeko/npm-icon-gen

ChangeLog

License

npm-icon-gen's People

Contributors

akabekobeko avatar

Watchers

Vlad Filippov avatar 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.