GithubHelp home page GithubHelp logo

create-icons's Introduction

create-icons

根据png图片制作Electorn客户端使用的.ico(windows),.icns(mac)格式的图标以及web端使用的favicon.ico,推荐使用1024x1024的png图片,只需一张图片,剩下的由程序搞定

install

  • Node.js:14.19.0
  • icon-gen如果装不上,可尝试直接从源码构建:npm install icon-gen --build-from-source --nodedir=/path-to/14.19.0

Quick Start

const { createIcons } = require('./index.js');
createIcons('1024.png', 'outputDir').then(res => {
    console.log(res);
}).catch(err => {
    console.log(err);
});

Notes

Mac环境,使用命令行工具制作icns图片,步骤如下:

  • 生成临时文件夹:folder.iconset,文件夹名称随便都可以,但必须使用.iconset后缀

  • 使用mac图片工具sips,根据原始图片,制作不同尺寸的图片备用,全部尺寸为:[16, 32, 128, 256, 512],每个尺寸除自身外还需要再额外制作一个2倍图,命令为

    sips -z 16 16 inputPath --out folder.iconset/icon_16x16.png
    sips -z 32 32 inputPath --out folder.iconset/[email protected]

    共生成10张图片,且都保存在上一步的临时文件夹中

  • 使用iconutil命令把folder.iconset生成为icns

    iconutil -c icns folder.iconset -o output.icns

create-icons's People

Contributors

lhc-up avatar

Watchers

 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.