ICO file format parser and builder.
npm install @igor-arkhipov/ico
import fs from 'fs'
import { Ico } from '@igor-arkhipov/ico'
const buf = fs.readFileSync('icon.ico')
const ico = Ico.from(buf)
console.log(ico.fileHeader) // IcoFileHeader { reserved: 0, type: 1, count: 7 }
console.log(ico.infoHeaders[0]) // IcoInfoHeader { width: 16, height: 16, ... }
import fs from 'fs'
import { Ico, IcoImage } from '@igor-arkhipov/ico'
const ico = new Ico()
let buf
buf = fs.readFileSync('128x128.png')
image = IcoImage.fromPNG(buf)
ico.append(image)
buf = fs.readFileSync('256x256.png')
image = IcoImage.fromPNG(buf)
ico.append(image)
/* Some other PNG files */
fs.writeFileSync('icon.ico', ico.data)
Create ICO from the icon buffer.
Type: Buffer
The ICO icon buffer.
Adds ICO image at the end.
Type: IcoImage
The ICO Image to append.
Inserts ICO image at the specified position.
Type: IcoImage
The ICO Image to insert.
Type: number
The position at which to insert the ICO Image.
Removes ICO image at the specified position.
Type: number
The position of the ICO Image to remove.
Type: IcoFileHeader
Return the file header on the ICO.
Type: IcoInfoHeader[]
Return the ICO info header on the ICO.
Type: IcoImage[]
Return the ICO images on the ICO.
Type: Buffer
Return the ICO buffer.
Create ICO image from the buffer.
Type: Buffer
The ICO image buffer.
Create ICO Image from the PNG image buffer.
Type: Buffer
The PNG image buffer.
Create ICO info header from the buffer.
Type: Buffer
The ICO info header buffer.
Create ICO file header from the buffer.
Type: Buffer
The ICO file header buffer.
Size |
---|
16x16 |
24x24 |
32x32 |
48x48 |
64x64 |
128x128 |
256x256 |