png2icns

A module to convert a .png file to an .icns file.

Usage no npm install needed!

<script type="module">
  import png2icns from 'https://cdn.skypack.dev/png2icns';
</script>

README

npm version License

png2icns

A command line and nodejs module to convert a .png file to an .icns file.

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.');
});

Installation

For command line usage:

npm install png2icns -g

To use programmatically (in NodeJS).

npm install png2icns --save

Usage

Command line

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

JavaScript

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.');
});