🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

png-strip-chunks

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

png-strip-chunks

Node module to strip PNG chunks to reduce file size.

npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

Node module to strip PNG chunks to reduce file size.

Usage

const PngStrip = require('png-strip-chunks'),
  fs = require('fs')

const buffer = await PngStrip.strip('/path/to/image.png or buffer')
fs.writeFileSync('/path/to/strip.png', buffer)

Chunks kept

// Keep core(IHDR, PLTE, IDAT, IEND) and 'tEXt'
const buffer = await PngStrip.strip(src, [PngStrip.types.core, 'tEXt'])

To set names of chunks to keep, pass an array or an array of array.

PngStrip.types is aliases.

const types = {
  core: ['IHDR', 'PLTE', 'IDAT', 'IEND'],
  transparency: ['tRNS'],
  colorSpace: ['gAMA', 'cHRM', 'sRGB', 'iCCP', 'sBIT'],
  textual: ['tEXt', 'zTXt', 'iTXt'],
  misc: ['bKGD', 'pHYs', 'sPLT', 'hIST'],
  time: ['tIME'],
}

See http://www.libpng.org/pub/png/spec/iso/index-object.html#11Chunks

FAQs

Package last updated on 03 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts