image-min

Minify GIF, JPEG and PNG images

MIT 16 个版本
安装
npm install image-min
yarn add image-min
pnpm add image-min
bun add image-min
README

image-min Build Status

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

Install

npm install --save image-min

Usage

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));

API

imagemin(opts)

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

Options

ext

Type String
Default: undefined

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

interlaced (GIF only)

Type: Boolean
Default: false

Interlace gif for progressive rendering.

pngquant (PNG only)

Type: Boolean
Default: false

Whether to enable pngquant lossy compression.

progressive (JPEG only)

Type: Boolean
Default: false

Lossless conversion to progressive.

Used by

License

MIT License © Kevin Mårtensson

版本列表
0.4.5 2014-04-24
0.4.4 2014-04-23
0.4.2 2014-04-22
0.4.1 2014-04-22
0.4.0 2014-04-22
0.3.2 2014-08-31
0.3.0 2014-04-03
0.2.3 2014-04-02
0.2.2 2014-03-28
0.2.1 2014-03-28
0.2.0 2014-03-21
0.1.4 2014-04-01
0.1.3 2014-01-17
0.1.2 2014-01-13
0.1.1 2013-12-21
0.1.0 2013-12-17