This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

create-ico
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

create-ico

Creates an ico file from a single input image, using sharp to resize the image to specified icon sizes (and apply an optional circular mask), pngquant to optimize the pngs, and icon-encoder to assemble the ico (the older to-ico chokes on optimized pngs).

Especially useful for favicons, as pngquant keeps the ico file as small as possible, and the optional mask makes it possible to generate a round favicon from the same square image used for maskable home screen icons.

Install

npm install create-ico

Usage

createIco(input: string | Buffer, options?: CreateIcoOptions): Promise<Buffer>
createIco(input: string | Buffer, output: string, options?: CreateIcoOptions): Promise<void>

  • input The input image as accepted by sharp.
  • output The output file path. (Optional)
  • options (Optional)
    • shape: 'circle' Optional mask to apply to the icon. (Optional)
    • sizes: number[] Icon sizes to generate. Defaults to [16, 32], as recommended for favicons. Size cannot exceed 256 (the ico format stores width & height as a single byte each). (Optional)
    • pngquant Options passed to pngquant. Defaults to speed 1, strip metadata. See docs here. (Optional)
import { createIco } from 'create-ico';

await createIco('image.png', 'output.ico', { shape: 'circle' });

// or
let ico = await createIco('image.png', { sizes: [16, 32, 64, 256] });
fs.writeFileSync('output.ico', ico);

Package Sidebar

Install

npm i create-ico

Weekly Downloads

16

Version

1.0.0

License

MIT

Unpacked Size

17.5 kB

Total Files

8

Last publish

Collaborators

  • maxkagamine