If all image options (ico,icns, favicon) are omitted, all images are output with their default settings.
// Output an all images with default settingsconstoptions={report: true}
If individual image option is omitted, default setting is used. If there is a format that you do not want to output, specify others and omit that image.
// Without ICNSconstoptions={report: true,ico: {}favicon: {}}
Name
Type
Description
report
Boolean
Display the process reports. Default is false, disable a report.
ico
Object
Output setting of ICO file.
icns
Object
Output setting of ICNS file.
favicon
Object
Output setting of Favicon file (PNG and ICO).
ico, icns
Name
Type
Default
Description
name
String
app
Name of an output file.
sizes
Number[]
[Defaults...]
Structure of an image sizes.
favicon
Name
Type
Default
Description
name
String
favicon-
Prefix of an output PNG files. Start with the alphabet, can use - and _. This option is for PNG. The name of the ICO file is always favicon.ico.
pngSizes
Number[]
[Defaults...]
Size structure of PNG files to output.
icoSizes
Number[]
[Defaults...]
Structure of an image sizes for ICO.
CLI
Usage: icon-gen [options]
Generate an icon from the SVG or PNG file.
If "--ico", "--icns", "--favicon" is not specified, everything is output in the standard setting.
Options:
-i, --input <Path> Path of the SVG file or PNG file directory.
-o, --output <Path> Path of the output directory.
-r, --report Display the process reports, default is disable.
--ico Output ICO file with default settings, option is "--ico-*".
--ico-name <Name> ICO file name to output.
--ico-sizes [Sizes] PNG size list to structure ICO file
--icns Output ICNS file with default settings, option is "--icns-*".
--icns-name <Name> ICO file name to output.
--icns-sizes [Sizes] PNG size list to structure ICNS file
--favicon Output Favicon files with default settings, option is "--favicon-*".
--favicon-name <Name> prefix of the PNG file. Start with the alphabet, can use "-" and "_"
--favicon-png-sizes [Sizes] Sizes of the Favicon PNG files
--favicon-ico-sizes [Sizes] PNG size list to structure Favicon ICO file
-v, --version output the version number
-h, --help output usage information
Examples:
$ icon-gen -i sample.svg -o ./dist -r
$ icon-gen -i ./images -o ./dist -r
$ icon-gen -i sample.svg -o ./dist --ico --icns
$ icon-gen -i sample.svg -o ./dist --ico --ico-name sample --ico-sizes 16,32
$ icon-gen -i sample.svg -o ./dist --icns --icns-name sample --icns-sizes 16,32
$ icon-gen -i sample.svg -o ./dist --favicon --favicon-name=favicon- --favicon-png-sizes 16,32,128 --favicon-ico-sizes 16,32
See also:
https://github.com/akabekobeko/npm-icon-gen
请发表评论