image-min

Minify GIF, JPEG and PNG images

image-min

Minify GIF, JPEG and PNG images seamlessly with Node.js.

npm install --save image-min
var fs = require('fs');
var imagemin = require('image-min');
var path = require('path');
 
var src = fs.createReadStream('img.gif');
var ext = path.extname(src.path);
 
src
    .pipe(imagemin({ ext: ext }))
    .pipe(fs.createWriteStream('img-minified' + ext));

Optimize a GIF, JPEG, or PNG image by providing a an ext. Use the options below (optionally) to configure how your images are optimized.

Type String
Default:

File extension used by imagemin to determine which optimizer to use.

Type: Boolean
Default: false

Interlace gif for progressive rendering.

Type: Boolean
Default: false

Whether to enable pngquant lossy compression.

Type: Boolean
Default: false

Lossless conversion to progressive.

MIT License © Kevin Mårtensson