Convert Image to Apple Icon Image format.
npm install @fiahfy/icns-convert
import fs from 'fs'
import { convert } from '@fiahfy/icns-convert'
const buf = fs.readFileSync('input.png') // image must be squre, 1024x1024 pixels or larger
convert(buf).then((data) => {
fs.writeFileSync('output.icns', data)
})
const bufs = [
fs.readFileSync('16x16.png'),
fs.readFileSync('32x32.png'),
fs.readFileSync('64x64.png'),
fs.readFileSync('128x128.png'),
fs.readFileSync('256x256.png'),
fs.readFileSync('512x512.png'),
fs.readFileSync('1024x1024.png'),
]
convert(bufs).then((data) => {
fs.writeFileSync('output.icns', data)
})
npm install -g @fiahfy/icns-convert
icns-convert icon.png
or use via npx
npx @fiahfy/icns-convert icon.png