• Stars
    star
    316
  • Rank 132,587 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Imagemin plugin for `pngquant`

imagemin-pngquant GitHub Actions Status

Imagemin plugin for pngquant

Install

$ npm install imagemin-pngquant

Usage

const imagemin = require('imagemin');
const imageminPngquant = require('imagemin-pngquant');

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

	console.log('Images optimized');
})();

API

imageminPngquant(options?)(input)

Returns Promise<Buffer>.

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.

verbose

Type: boolean
Default: false

Print verbose status messages.

input

Type: Buffer | Stream

Buffer or stream to optimize.

More Repositories

1

imagemin

Minify images seamlessly
JavaScript
5,562
star
2

imagemin-cli

Minify images seamlessly
JavaScript
923
star
3

imagemin-app

imagemin as an OS X, Linux and Windows app
JavaScript
826
star
4

imagemin-webp

WebP plugin for imagemin
JavaScript
496
star
5

imagemin-mozjpeg

Imagemin plugin for mozjpeg
JavaScript
251
star
6

imagemin-optipng

optipng plugin for imagemin
JavaScript
163
star
7

imagemin-svgo

SVGO plugin for imagemin
JavaScript
126
star
8

mozjpeg-bin

mozjpeg bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
120
star
9

imagemin-jpegtran

jpegtran plugin for imagemin
JavaScript
119
star
10

imagemin-gifsicle

Imagemin plugin for Gifsicle
JavaScript
116
star
11

pngquant-bin

pngquant bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
115
star
12

gifsicle-bin

gifsicle bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
113
star
13

optipng-bin

optipng bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
97
star
14

jpegtran-bin

jpegtran bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
93
star
15

cwebp-bin

cwebp bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
92
star
16

imagemin-guetzli

imagemin plugin for guetzli https://github.com/google/guetzli
JavaScript
81
star
17

imagemin-jpeg-recompress

jpeg-recompress imagemin plugin
JavaScript
63
star
18

imagemin-micro

Microservice for Imagemin
JavaScript
61
star
19

zopflipng-bin

zopflipng bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
51
star
20

pngcrush-bin

pngcrush bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
39
star
21

imagemin-jpegoptim

Imagemin plugin for jpegoptim
JavaScript
38
star
22

guetzli-bin

guetzli wrapper that makes it seamlessly available as a local dependency
JavaScript
30
star
23

imagemin-zopfli

zopfli plugin for imagemin
JavaScript
26
star
24

jpeg-recompress-bin

jpeg-recompress bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
25
star
25

jpegoptim-bin

jpegoptim bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
24
star
26

imagemin-pngcrush

pngcrush plugin for imagemin
JavaScript
23
star
27

imagemin-pngout

pngout plugin for imagemin
JavaScript
14
star
28

pngout-bin

pngout bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
14
star
29

imagemin-advpng

AdvPNG plugin for imagemin
JavaScript
9
star
30

advpng-bin

AdvPNG bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
8
star
31

logo

The imagemin logo
CSS
7
star
32

gif2webp-bin

gif2webp bin-wrapper that makes it seamlessly available as a local dependency
JavaScript
7
star
33

imagemin-gif2webp

gif2webp plugin for imagemin
JavaScript
6
star
34

meta

General discussion repo for imagemin related projects
6
star
35

imagemin.io

The site for imagemin
CSS
4
star