Installation
CLI global install:
npm install async-icns -g
To use programmatically (in NodeJS).
npm install async-icns --save
# Or for yarn
yarn add async-icns
CLI Usage
$ async-icns file.png
Note that if your icon is smaller than 1024 × 1024
, you will have to remove one of the size options. Make sure that the largest size you request is less than half the size as your icon. For example, if one of your icons was 512 × 512
, the max icon size would be 256 × 256
:
$ async-icns file.png -s 16,32,64,128,256
You can aso specify the alternative output:
$ async-icns file.png -o output.icns
As a library
const { convert } = require('async-icns')
async function main() {
await convert({ input: 'file.png', output: 'output.icns' })
}
main()
You can also specify the output size in the same way as specifed above:
const { convert } = require('async-icns')
async function main() {
await convert({
input: 'file.png',
output: 'output.icns',
sizes: [16, 32, 64, 128, 256],
})
}
main()