A command line and nodejs module to convert a .png file to an .icns file. Works on Mac only.
It expects a 1024*1024
png file to convert. If your files is less in size then skip the maximum size in options
.
For example, if your file is 512*512
:
Command line:
$ png2icns file.png -s 16,32,64,128,256
In JavaScript:
png2icns({
in: 'file.png',
sizes: [16, 32, 64, 128, 256]
}, function () {
console.log('Successfully converted.');
});
For command line usage:
npm install png2icns -g
To use programmatically (in NodeJS).
npm install png2icns --save
Simply give it path of png file you want to convert.
$ png2icns file_to_convert.png
$ png2icns file.png
$ png2icns file.png -o file.icns // file to output as
$ png2icns file.png -o file.icns -s 16,32,64,128,256,512 // sizes you want in your .icns file
var png2icns = require('png2icns');
png2icns({
in: 'file.png', // required
out: 'output.icns' // optional. .icns file name to save the file as. Default: icon.icns
sizes: [16, 32, 64, 128, 256, 512] // optional.
}, function () {
console.log('Successfully converted.');
});