How to use the jpegtran-bin.path function in jpegtran-bin

To help you get started, we’ve selected a few jpegtran-bin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iolo / pictor / libs / imgutils.js View on Github external
.then(function (format) {
      switch (format) {
        case 'JPEG':
          var jpegtran = require('jpegtran-bin').path;
          return Q.nfcall(execFile, jpegtran, ['-copy', 'none', '-optimize', '-outfile', dst, src]);
        case 'PNG':
          var optipng = require('optipng-bin').path;
          return Q.nfcall(execFile, optipng, ['-quiet', '-force', '-strip', 'all', '-out', dst, src]);
        case 'GIF':
          var gifsicle = require('gifsicle').path;
          return Q.nfcall(execFile, gifsicle, ['--careful', '-w', '-o', dst, src]);
      }
      // unsupported format!?
      // simply convert it without profile data!
      return convert(src, dst);
    });
}
github imagemin / imagemin / index.js View on Github external
Imagemin.prototype._optimizeJpeg = function () {
    var args = ['-copy', 'none', '-optimize'];
    var jpegtran = require('jpegtran-bin').path;

    if (this.opts.progressive) {
        args.push('-progressive');
    }

    return spawn(jpegtran, args);
};
github imagemin / imagemin / lib / plugins / jpegtran.js View on Github external
'use strict';

var execFile = require('child_process').execFile;
var fs = require('fs');
var imageType = require('image-type');
var jpegtran = require('jpegtran-bin').path;
var tempfile = require('tempfile');
var rm = require('rimraf');

/**
 * jpegtran image-min plugin
 *
 * @param {Object} opts
 * @api public
 */

module.exports = function (opts) {
    opts = opts || {};

    return function (file, imagemin, cb) {
        if (imageType(file.contents) !== 'jpg') {
            return cb();

jpegtran-bin

jpegtran (part of libjpeg-turbo) bin-wrapper that makes it seamlessly available as a local dependency

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular jpegtran-bin functions