Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

img-optim

0.0.2 • Public • Published

img-optim

Optimize (lossless and lossy compression) images (jpeg, png, gif, svg) using external utilities:

Based on ImageOptim.app and image_optim ruby gem.

I am expecting you know basics of image optimization, so for each situation you just choose best runner config yourself for your needs.

Installation

  1. Install from npm.
npm install --save img-optim
  1. Install binaries

Binaries installation

OS X: Brew

Tested on 10.9.

brew install advancecomp pngcrush optipng pngquant pngnq libjpeg-turbo jpegoptim

Note about libjpeg-turbo. It is fork of libjpeg and it can be drop-in replacement for libjpeg (almost in all features), but in brew it is installed keg-only and you will need to specify full path to binary jpegtran.

pngout installation

Pngout very good for png compression as it implements own deflate algorithm, but it is very-very slow, and sometimes does not gain any advantage (as advpng implemented zopfli - so probably you will not get any advantage). I recommend use it only if you know that you need it.

You can install pngout by downloading and installing the binary versions.

Note: pngout is free to use even in commercial soft, but you can not redistribute, repackage or reuse it without consent and agreement of creator. license

svgo installation

svgo is available from NPM.

npm install -g svgo

Usage

var images = ['./url.gif'];
var Runner = require('./lib/runner');
 
var runner = new Runner();
 
runner.run(images, function (err, files) {
    console.log(err, files);
});

Install

npm i img-optim

DownloadsWeekly Downloads

6

Version

0.0.2

License

MIT

Last publish

Collaborators

  • avatar