node-pngquant-native is an addon of node, support node version v0.8.0 to latest, It compress a
.png image, so can't call other processes.
npm install -g node-pngquant-native
if install fail for you. download the source install it.
clone source code
$ git clone
npm install -g .
$ cd node-pngquant-native$ npm install -g .
node-gyp, you can see detail information https://github.com/TooTallNate/node-gyp#installation
win32, because VS not support C99.
var pngquant = ;fs;
var pngquant =var option =speed: 11//...var resBuffer = pngquant;
Speed/quality trade-off from 1 (brute-force) to 11 (fastest). The default is 3. Speed 10 has 5% lower quality, but is 8 times faster than the default. Speed 11 disables dithering and lowers compression level.
var opt =speed: 11
quality = [min, max]
min and max are numbers in range 0 (worst) to 100 (perfect), similar to JPEG. pngquant will 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 (if outputting to stdin, 24-bit original will be output) and pngquant will exit with status code 99.
var opt =quality: 40 60
Workaround for IE6, which only displays fully opaque pixels. pngquant will make almost-opaque pixels fully opaque and will avoid creating new transparent colors.
var opt =iebug: true