Package Exports
- imageoptim
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (imageoptim) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
image-optim

Node.js wrapper for some images compression algorithms: PNGOUT, Zopfli, Pngcrush, AdvPng and OptiPNG.
Types
- PNG
Supporting of other types of images are coming soon.
Install
$ npm install imageoptimUsage
API
var imageOptim = require('imageoptim');imageOptim.optim
Optimizes the given files.
@param {Array} - a list of paths to files to optimize
@returns {Promise * Array} - the information about optimized files:
[{ name: 'file.ext', savedBytes: 12345, exitCode: 0 }]imageOptim.lint
Checks whether the given files can be optimized further.
@param {Array} - a list of paths to files to check
@param {Object} - options:
- tolerance {Number} - sets the measurement error during the check. If the difference in sizes between the raw file and the compressed file is less than or equal to the specified tolerance, image-optim will consider that the raw file can not be optimized further (default:
0)
@returns {Promise * Array} - the information about linted files:
[{ name: 'file.ext', isOptimized: false, exitCode: 0 }]imageOptim.SUCCESS
If the file was processed without errors its exit code will be equal to 0.
imageOptim.CANT_COMPRESS
If the file can not be compressed its exit code will be equal to 1.
imageOptim.DOESNT_EXIST
If the file does not exist its exit code will be equal to 2.
CLI
$ imageoptim --help
Node.js wrapper for some images compression algorithms
Usage:
imageoptim [OPTIONS] [ARGS]
Options:
-h, --help : Help
-v, --version : Shows the version number
-l, --lint : Lint mode
-t TOLERANCE, --tolerance=TOLERANCE : Tolerance (default: 0)
Arguments:
FILES : Paths to files (required)