No description
Find a file
2024-10-06 17:08:50 +08:00
examples/data o 2020-05-02 17:11:13 +08:00
src use icp4, icp5, icp6, drop is32, il32 2024-10-06 17:08:50 +08:00
tests try to fix icns 2024-10-06 16:23:43 +08:00
.gitignore fix icns gen 2021-03-27 16:56:17 +08:00
icon.nimble fix color pack 2021-03-28 10:14:47 +08:00
README.md restruct dir, export favicon,fix tests 2021-03-28 09:43:05 +08:00

icon

Generate an icon files from PNG files.

port of typescript project akabekobeko/npm-icon-gen

Support formats

Supported the output format of the icon are following.

Platform Icon
Windows app.ico or specified name.
macOS app.icns or specified name.
Favicon favicon.ico and favicon-XX.png.

Installation

$ nimble install https://github.com/bung87/icon

Usage

import icon/icns
import asyncdispatch
import sequtils

let dir = getTempDir()
let images = icns.REQUIRED_IMAGE_SIZES.map(proc (size:int):ImageInfo{.closure.} =
    let filePath = getCurrentDir() / "./examples/data" /  $size & ".png"
    result = ImageInfo( size:size, filePath:filePath )
)
let path = waitfor generateICNS(images,dir)
# or generateICNSAsync(images, dir)

import asyncdispatch
import icon/ico
import sequtils

let images = ico.REQUIRED_IMAGE_SIZES.map(proc (size: int): ImageInfo{.closure.} =
      let filePath = root / "./examples/data" / $size & ".png"
      echo filePath
      result = ImageInfo(size: size, filePath: filePath)
    )
let path = generateICO(images, dir)
# or generateICOAsync(images, dir)