imagemin-pngquant
pngquant image-min plugin
Last updated 11 years ago by kevva .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install imagemin-pngquant 
SYNC missed versions from official npm registry.

imagemin-pngquant

Imagemin plugin for pngquant

Install

npm install imagemin-pngquant

Prerequisites

Linux machines must have the following packages prior to install: libpng-dev libimagequant-dev

sudo apt-get -y install libpng-dev libimagequant-dev

Usage

import imagemin from 'imagemin';
import imageminPngquant from 'imagemin-pngquant';

await imagemin(['images/*.png'], {
	destination: 'build/images',
	plugins: [
		imageminPngquant()
	]
});

console.log('Images optimized');

API

imageminPngquant(options?)(input)

Returns Promise<Uint8Array>.

options

Type: object

speed

Type: number
Default: 4
Values: 1 (brute-force) to 11 (fastest)

Speed 10 has 5% lower quality, but is about 8 times faster than the default. Speed 11 disables dithering and lowers compression level.

strip

Type: boolean
Default: false

Remove optional metadata.

quality

Type: Array<min: number, max: number>
Values: Array<0...1, 0...1>
Example: [0.3, 0.5]

Instructs pngquant to use the least amount of colors required to meet or exceed the max quality. If conversion results in quality below the min quality the image won't be saved.

Min and max are numbers in range 0 (worst) to 1 (perfect), similar to JPEG.

dithering

Type: number | boolean
Default: 1 (full)
Values: 0...1

Set the dithering level using a fractional number between 0 (none) and 1 (full).

Pass in false to disable dithering.

posterize

Type: number

Truncate number of least significant bits of color (per channel). Use this when image will be output on low-depth displays (e.g. 16-bit RGB). pngquant will make almost-opaque pixels fully opaque and will reduce amount of semi-transparent colors.

input

Type: Uint8Array

Image data to optimize.

Current Tags

  • 10.0.0                                ...           latest (8 months ago)

29 Versions

  • 10.0.0                                ...           8 months ago
  • 9.0.2                                ...           4 years ago
  • 9.0.1                                ...           4 years ago
  • 9.0.0                                ...           5 years ago
  • 8.0.0                                ...           6 years ago
  • 7.0.0                                ...           6 years ago
  • 6.0.1                                ...           6 years ago
  • 6.0.0                                ...           6 years ago
  • 5.1.0                                ...           7 years ago
  • 5.0.1                                ...           8 years ago
  • 5.0.0                                ...           9 years ago
  • 4.2.2                                ...           9 years ago
  • 4.2.1                                ...           9 years ago
  • 4.2.0                                ...           9 years ago
  • 4.1.2                                ...           9 years ago
  • 4.1.1                                ...           9 years ago
  • 4.1.0                                ...           10 years ago
  • 4.0.0                                ...           10 years ago
  • 3.1.0                                ...           10 years ago
  • 3.0.0                                ...           10 years ago
  • 2.0.1                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.1.3                                ...           10 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE