Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.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);
});
}
Imagemin.prototype._optimizeGif = function () {
var args = ['-w'];
var gifsicle = require('gifsicle').path;
if (this.opts.interlaced) {
args.push('--interlace');
}
return spawn(gifsicle, args);
};
'use strict';
var execFile = require('child_process').execFile;
var fs = require('fs');
var gifsicle = require('gifsicle').path;
var imageType = require('image-type');
var tempfile = require('tempfile');
var rm = require('rimraf');
/**
* gifsicle image-min plugin
*
* @param {Object} opts
* @api public
*/
module.exports = function (opts) {
opts = opts || {};
return function (file, imagemin, cb) {
if (imageType(file.contents) !== 'gif') {