Skip to content

fiahfy/icns-convert

Repository files navigation

icns-convert

badge

Convert Image to Apple Icon Image format.

Installation

npm install @fiahfy/icns-convert

Usage

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)
})

Specify image for each size

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)
})

CLI

npm install -g @fiahfy/icns-convert
icns-convert icon.png

or use via npx

npx @fiahfy/icns-convert icon.png

About

Convert Image to Apple Icon Image format.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published