GithubHelp home page GithubHelp logo

1000ch / gulp-image Goto Github PK

View Code? Open in Web Editor NEW
222.0 7.0 23.0 3.73 MB

Optimize PNG, JPEG, GIF, SVG images with gulp task.

Home Page: http://bit.ly/we-should-optimize-images

License: MIT License

JavaScript 100.00%
gulp image optimization jpeg gif png

gulp-image's Introduction

gulp-image GitHub Actions Status

Optimize PNG, JPEG, GIF, SVG images with gulp task.

gulp-image result

Install

$ npm install --save-dev gulp-image

External Dendencies

This package includes multiple image-related libraries so that you might be required to install several external dependencies like libjpeg or libpng. Please install them as needed with Homebrew on macOS or apt (Advanced Package Tool) on Linux.

Usage

This is an example of gulpfile.js.

import gulp from 'gulp';
import image from 'gulp-image';

gulp.task('image', () => {
  gulp.src('./fixtures/*')
    .pipe(image())
    .pipe(gulp.dest('./dest'));
});

gulp.task('default', ['image']);

You can pass an object to image() as argument such as following:

gulp.task('image', () => {
  gulp.src('./fixtures/*')
    .pipe(image({
      pngquant: true,
      optipng: false,
      zopflipng: true,
      jpegRecompress: false,
      mozjpeg: true,
      gifsicle: true,
      svgo: true,
      concurrent: 10,
      quiet: true // defaults to false
    }))
    .pipe(gulp.dest('./dest'));
});

Set false for optimizers which you don't want to apply. And you can set concurrent option to limit the max concurrency in execution. You can also set quiet to avoid logging out results for every image processed.

You can configure parameters applied to each optimizers such as following:

gulp.task('image', () => {
  gulp.src('./fixtures/*')
    .pipe(image({
      optipng: ['-i 1', '-strip all', '-fix', '-o7', '-force'],
      pngquant: ['--speed=1', '--force', 256],
      zopflipng: ['-y', '--lossy_8bit', '--lossy_transparent'],
      jpegRecompress: ['--strip', '--quality', 'medium', '--min', 40, '--max', 80],
      mozjpeg: ['-optimize', '-progressive'],
      gifsicle: ['--optimize'],
      svgo: {} // svgo accepts options defined on https://github.com/svg/svgo#configuration
    }))
    .pipe(gulp.dest('./dest'));
});

License

MIT © Shogo Sensui

gulp-image's People

Contributors

1000ch avatar craigguest avatar dependabot-preview[bot] avatar dependabot[bot] avatar earthson avatar elyobo avatar erikdahlstrom avatar ernest-okot avatar firetix avatar simonfairbairn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-image's Issues

Duplicate console log

Hey, first: gulp-image is compression the images very good!

task:

gulp.task('image', () => {
  plugins.watch('./src/**/*.{jpg,jpeg,png}', {
    name: 'image',
    read: false,
    ignoreInitial: false
  }, () => {
    gulp.src('./src/**/*.{jpg,jpeg,png}')
      .pipe(plugins.changed('./app/**/*.{jpg,jpeg,png}'))
      .pipe(plugins.image())
      .pipe(gulp.dest('./app'));
  });
});

gulp.task('default', ['image']);

In ./src/web/public/img/ are 2 images, one jpg and one png, but the console log is duplicated so i get

[15:09:26] ✔ web\public\img\default_avatar.jpg -> before=779 B after=620 B reduced=159 B(20.4%)
[15:09:26] ✔ web\public\img\default_avatar.jpg -> before=779 B after=620 B reduced=159 B(20.4%)
[15:09:27] ✔ web\public\img\default_avatar.png -> before=1.98 KB after=1.75 KB reduced=235 B(11.6%)
[15:09:27] ✔ web\public\img\default_avatar.png -> before=1.98 KB after=1.75 KB reduced=235 B(11.6%)

Node version: 7
gulp-image version: 2.7.2
OS: windows 10 64 bit

// edit
With 4 images in the folder i get the following log:

[15:29:02] ✔ web\public\img\default_avatar.jpg -> before=779 B after=620 B reduced=159 B(20.4%)
[15:29:02] ✔ web\public\img\default_avatar.jpg -> before=779 B after=620 B reduced=159 B(20.4%)
[15:29:02] ✔ web\public\img\default_avatar.jpg -> before=779 B after=620 B reduced=159 B(20.4%)
[15:29:02] ✔ web\public\img\default_avatar.jpg -> before=779 B after=620 B reduced=159 B(20.4%)
(node:8204) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
[15:29:03] ✔ web\public\img\default_avatar.png -> before=1.98 KB after=1.75 KB reduced=235 B(11.6%)
[15:29:04] ✔ web\public\img\default_avatar.png -> before=1.98 KB after=1.75 KB reduced=235 B(11.6%)
[15:29:04] ✔ web\public\img\default_avatar.png -> before=1.98 KB after=1.75 KB reduced=235 B(11.6%)
[15:29:05] ✔ web\public\img\default_avatar.png -> before=1.98 KB after=1.75 KB reduced=235 B(11.6%)
[15:29:10] - web\public\img\nodejs_logo.png -> Cannot improve upon 5.9 KB
[15:29:10] - web\public\img\nodejs_logo.png -> Cannot improve upon 5.9 KB
[15:29:10] - web\public\img\nodejs_logo.png -> Cannot improve upon 5.9 KB
[15:29:10] - web\public\img\nodejs_logo.png -> Cannot improve upon 5.9 KB
[15:29:13] ✔ web\public\img\coffeescript_logo.png -> before=12.3 KB after=8.16 KB reduced=4.14 KB(33.7%)
[15:29:13] ✔ web\public\img\coffeescript_logo.png -> before=12.3 KB after=8.16 KB reduced=4.14 KB(33.7%)
[15:29:13] ✔ web\public\img\coffeescript_logo.png -> before=12.3 KB after=8.16 KB reduced=4.14 KB(33.7%)
[15:29:13] ✔ web\public\img\coffeescript_logo.png -> before=12.3 KB after=8.16 KB reduced=4.14 KB(33.7%)

Lots of errors when installing

I'm getting a lot of errors when installing gulp-image. All seem to be relating to external packages. But it makes it impossible to use gulp-image. I used the following command:

sudo npm install gulp-image

> [email protected] postinstall /Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/pngcrush-bin
> node ./lib/build.js

  pngcrush-1.7.70.zip: downloading [===================] 100% 0.0s


✗ Command failed: pngcrush.c:2320:19: warning: explicitly assigning a variable of type 'char' to itself [-Wself-assign]
        keystroke = keystroke;  /* stifle compiler warning */
        ~~~~~~~~~ ^ ~~~~~~~~~
pngcrush.c:2994:20: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
    do_color_count = do_color_count;    /* silence compiler warning */
    ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
pngcrush.c:3887:25: warning: explicitly assigning a variable of type 'const char *' to itself [-Wself-assign]
                outname = outname;
                ~~~~~~~ ^ ~~~~~~~
3 warnings generated.
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
> [email protected] postinstall /Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/advpng-bin
> node ./lib/build.js

  advancecomp-1.18.tar.gz: downloading [===================] 100% 0.0s


✗ Command failed: siglock.cc:25:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
1 warning generated.
7z/LZMAEncoder.cc:667:47: warning: '&&' within '||' [-Wlogical-op-parentheses]
        aRepLens[RepMaxIndex] + 2 >= aLenMain && (aBackMain > (1<<12)))
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7z/LZMAEncoder.cc:667:47: note: place parentheses around the '&&' expression to silence this warning
        aRepLens[RepMaxIndex] + 2 >= aLenMain && (aBackMain > (1<<12)))
                                              ^
        (                                                             )
7z/LZMAEncoder.cc:683:46: warning: '&&' within '||' [-Wlogical-op-parentheses]
        m_LongestMatchLength == aLenMain + 1 &&
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
7z/LZMAEncoder.cc:683:46: note: place parentheses around the '&&' expression to silence this warning
        m_LongestMatchLength == aLenMain + 1 &&
                                             ^
7z/LZMAEncoder.cc:686:46: warning: '&&' within '||' [-Wlogical-op-parentheses]
        m_LongestMatchLength + 1 >= aLenMain &&
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
7z/LZMAEncoder.cc:686:46: note: place parentheses around the '&&' expression to silence this warning
        m_LongestMatchLength + 1 >= aLenMain &&
                                             ^
3 warnings generated.
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
> [email protected] postinstall /Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/jpeg-recompress-bin
> node ./lib/build.js


/Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/jpeg-recompress-bin/node_modules/bin-wrapper/node_modules/progress/lib/node-progress.js:125
  complete = Array(complete).join(this.chars.complete);
             ^
RangeError: Invalid array length
    at ProgressBar.render (/Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/jpeg-recompress-bin/node_modules/bin-wrapper/node_modules/progress/lib/node-progress.js:125:14)
    at ProgressBar.tick (/Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/jpeg-recompress-bin/node_modules/bin-wrapper/node_modules/progress/lib/node-progress.js:92:8)
    at IncomingMessage.<anonymous> (/Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/jpeg-recompress-bin/node_modules/bin-wrapper/bin-wrapper.js:122:17)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (_stream_readable.js:746:14)
    at IncomingMessage.EventEmitter.emit (events.js:92:17)
    at emitReadable_
> [email protected] postinstall /Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/pngquant-bin
> node lib/check.js


module.js:340
    throw err;
          ^
Error: Cannot find module '../lang/toString'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/pngquant-bin/node_modules/bin-wrapper/node_modules/mout/string/endsWith.js:1:78)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
> [email protected] postinstall /Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/zopflipng-bin
> node ./lib/build.js


module.js:340
    throw err;
          ^
Error: Cannot find module '/Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/node_modules/gulp-image/node_modules/zopflipng-bin/lib/build.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
npm ERR! [email protected] postinstall: `node ./lib/build.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the jpeg-recompresss-bin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./lib/build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls jpeg-recompress-bin
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "gulp-image"
npm ERR! cwd /Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/myname/Dropbox/Top Draw/Websites/GitHub/Shaw Conference Centre/www/wp-content/themes/shaw/build/npm-debug.log
npm ERR! not ok code 0

Mistake in readme.me svgo options

Hi,

in readme.md

gulp.task('image', function () {
  gulp.src('./fixtures/*')
    .pipe(image({
      svgo: {
        enable: ['removeRasterImages'], 
        disable: ['removeDoctype']
      }
    }))
    .pipe(gulp.dest('./dest'));
});

must be

gulp.task('image', function () {
  gulp.src('./fixtures/*')
    .pipe(image({
      svgo: {
        enables: ['removeRasterImages'], 
        disables: ['removeDoctype']
      }
    }))
    .pipe(gulp.dest('./dest'));
});

enables: ['removeRasterImages'],
disables: ['removeDoctype']

Installation Not Working

npm install gulp-image is no getting installed on Window.
Socket and Tunelling errors are encountered. Tried it multiple times but in vain.

Upgrade to 2.0.0 -> images are not processed anymore

After i upgraded to 2.0.0 my images are not processed anymore.

Output from ^1.0.0

[12:38:39] Starting 'imageOptimize'...
[12:38:39] Finished 'default' after 6.83 ms
[12:38:39] - Skyline_hintergrund.svg -> Cannot improve upon 2.66 KB
[12:38:39] - Skyline_hintergrund_ohneWolken.svg -> Cannot improve upon 2.16 KB
[12:38:39] - bullet-dark.svg -> Cannot improve upon 1.85 KB
[12:38:39] - bullet.svg -> Cannot improve upon 1.3 KB
[12:38:39] - clubhaus.svg -> Cannot improve upon 46.48 KB
[12:38:39] - dach.svg -> Cannot improve upon 2.62 KB
[12:38:39] - logo.svg -> Cannot improve upon 5.69 KB
[12:38:39] - siegel_geldzurueck.svg -> Cannot improve upon 10.1 KB
[12:38:39] - siegel_service.svg -> Cannot improve upon 8.72 KB
[12:38:39] - sprechblase.svg -> Cannot improve upon 1.13 KB
[12:38:39] - wolke1.svg -> Cannot improve upon 836 B
[12:38:39] - wolke2.svg -> Cannot improve upon 766 B
[12:38:39] - favicon/favicon.svg -> Cannot improve upon 2.25 KB
[12:38:39] ✔ favicon/favicon.png -> before=792 B after=565 B reduced=227 B(28.7%)
[12:38:39] ✔ siegel_geldzurueck.png -> before=14.53 KB after=6.86 KB reduced=7.67 KB(52.8%)
[12:38:39] ✔ kurve_boxen.png -> before=3.55 KB after=3.49 KB reduced=55 B(1.5%)
[12:38:39] Finished 'imageOptimize' after 561 ms

Output from ^2.0.0

[12:40:55] Starting 'default'...
[12:40:55] Starting 'imageOptimize'...
[12:40:55] Finished 'default' after 6.68 ms

Regression from version 4.1.0 to 4.2.0, install failing at mozjpeg

Version 4.1.0 installs and works perfectly. 🥇

However trying to install version 4.2.0 on Linux (Ubuntu 16.04) results in the following error:

Message:
    Command failed: /home/siilwyn/codeground/selwyn.cc/node_modules/mozjpeg/vendor/cjpeg -optimize -progressive -outfile /tmp/0ae2c407-8250-4d25-8755-282aa9542763 /tmp/80d2c3e1-7f29-4ab1-bd73-a4259606b36d
/home/siilwyn/codeground/selwyn.cc/node_modules/mozjpeg/vendor/cjpeg: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory


Details:
    code: 127
    killed: false
    stdout: 
    stderr: /home/siilwyn/codeground/selwyn.cc/node_modules/mozjpeg/vendor/cjpeg: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

    failed: true
    signal: null
    cmd: /home/siilwyn/codeground/selwyn.cc/node_modules/mozjpeg/vendor/cjpeg -optimize -progressive -outfile /tmp/0ae2c407-8250-4d25-8755-282aa9542763 /tmp/80d2c3e1-7f29-4ab1-bd73-a4259606b36d
    timedOut: false
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false

Type of optimization and limit on file size

Hi there,

This plugin is excellent and works well when the configuration is correct.

I have 2 question about it.

1- What type of optimization is used to compress the images?

2- Is there any limit on file size when running the plugin on gulp?

The first question is because I'm comparing the optimization with Kraken and on large file sizes there are still quite a bit to compress.

Kind regards,

Fernando Fas

Publish new version and run npm release

When trying to

npm install gulp-image --save-dev

I get following warning.

npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.

When will the latest dependency updates in package.json show up in the npm repository? Is it related to the version number released?

Thanks for your help.

Error on initialization: Library not loaded: /usr/local/lib/libjpeg.8.dylib

gulp-image is responding with the error below. Any ideas what I've done wrong? Thanks!

In Gulpfile.js

gulp.task('imageoptim', function() { gulp.src(source + 'images/*.{jpg,JPG}') .pipe(image()) .pipe(gulp.dest(dest + 'images')); });

Error in terminal

(node:5308) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error in plugin 'gulp-image'
Message:
write EPIPE
Details:
code: EPIPE
errno: EPIPE
syscall: write
killed: false
stdout:
stderr: dyld: Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /Users/marc/localhost/ar_live/node_modules/jpegoptim-bin/vendor/jpegoptim
Reason: image not found

failed: true
signal: null
cmd: /Users/marc/localhost/ar_live/node_modules/jpegoptim-bin/vendor/jpegoptim --strip-all --strip-iptc --strip-icc --stdin --stdout
timedOut: false

Load all files

Hi. This ext. load all files from folder, not only image types. Its correctly ?

Replace deprecated dependecy gulp-util

gulp-util has been deprecated recently. Continuing to use this dependency may prevent the use of your library with the latest release of Gulp 4 so it is important to replace gulp-util.

The README.md lists alternatives for all the components so a simple replacement should be enough.

Your package is popular but still relying on gulp-util, it would be good to publish a fixed version to npm as soon as possible.

See:

Task skips some files

Hi. Thanks for a great plugin.
However, I have faced with the following issue - for some reason some files are just being skipped. Task code:

gulp.task('images', function() {  
  return gulp.src(paths.img + '**/*')  
    .pipe(image({  
      concurrent: 10  
    }))  
    .pipe(gulp.dest('./assets/images'));  
});

It works great, but simply not processing more than a half of files. If I remove concurrent: 10 parameter, I get an error:

(node) warning: possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit.

and after that only some files are processed, even less than with parameter.

I have tried to wrap image() call with cache plugin, like this cache(image()), it worked, but optimization level is very very slight, like 5% or something.

Could you please help me with this? Thanks in advance.

6.3.1 doesn't work with the esm module loader

Possibly related to #139

When using esm, gulp-image 6.3.1 throws an error on all node versions I tried (14, 16 & 17):

[10:33:08] Requiring external module esm
TypeError: Invalid host defined options
    at eval (eval at <anonymous> (/Users/philipmarnef/Sites/xxxxxxxx/node_modules/gulp-cli/lib/shared/require-or-import.js:10:15), <anonymous>:3:1)
    at requireOrImport (/Users/philipmarnef/Sites/xxxxxxxx/node_modules/gulp-cli/lib/shared/require-or-import.js:24:7)
    at execute (/Users/philipmarnef/Sites/xxxxxxxx/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js:37:3)
    at Liftoff.handleArguments (/Users/philipmarnef/Sites/xxxxxxxx/node_modules/gulp-cli/index.js:211:24)
    at Liftoff.execute (/Users/philipmarnef/Sites/xxxxxxxx/node_modules/liftoff/index.js:201:12)
    at module.exports (/Users/philipmarnef/Sites/xxxxxxxx/node_modules/flagged-respawn/index.js:51:3)
    at Liftoff.<anonymous> (/Users/philipmarnef/Sites/xxxxxxxx/node_modules/liftoff/index.js:191:5)
    at /Users/philipmarnef/Sites/xxxxxxxx/node_modules/liftoff/index.js:149:9
    at /Users/philipmarnef/Sites/xxxxxxxx/node_modules/v8flags/index.js:162:14
    at /Users/philipmarnef/Sites/xxxxxxxx/node_modules/v8flags/index.js:41:14

Downgrading to 6.2.1 solves the issue.

Compressing images really slow

It seems to take about 2 minutes per image on my machine. Obviously something's wrong with my setup, but not sure what. I'm on a fresh project, a fresh install of gulp and dependencies.

[gulp] ✔ testimonial-panciuk.jpg -> before=19.01 kB after=18.81 kB reduced=208 B(1.1%)
[gulp] Finished 'images' in 2.42 min

Tried a JPG, same result:

[gulp] ✔ [email protected] -> before=3.03 kB after=2.77 kB reduced=265 B(8.7%)
[gulp] Finished 'images' in 2.22 min

And here is my images task:

gulp.task('images', function() {
    return gulp.src(['img/**/*.png', 'img/**/*.jpg', 'img/**/.*.gif'])
        .pipe(cache(image()))
        .pipe(gulp.dest('../../public/assets/public/img'));
});

What could be causing a problem like this, and where would I begin looking?

Activity Monitor shows kernal_task spiking up to around ~70%, but not consistently. Falls down to 1%, goes back up. Then, when the task is nearly completion, node hits 369,047,293...%.

Task silently fails

The task seems to be failing on some images which then stops processing all further images. There is no error output in the console, the last line is gulp-image reporting on the previous file.

When it fails, the gulp task stops processing anything further and is marked as completed successfully (the deploy job which is supposed to run after the build never even starts but there is a success code returned from gulp). I'm seeing this when using both svgo and pngquant plugins.

Not really anything useful in the logs but here's what it looks like when it fails:

[15:13:47] ✔ myparish/promohd.png -> before=638.83 KB after=365.09 KB reduced=273.75 KB(42.9%) [15:15:56] ✔ cartlogic/promo.png -> before=1.25 MB after=525.74 KB reduced=759.36 KB(59.1%) ➜ ml_web git:(develop) ✗

Files with .jpg extension breaking gulp task

Gulp-image is working great, however when passing .jpg images the task breaks and no images are output. When passing .jpeg images it works great. Is this a known limitation or a bug, or perhaps an issue with my configuration?

package.json

"gulp": "^3.9.1",
"gulp-image": "^2.0.1"

gulpfile.js

var image = require('gulp-image');

gulp.task('images', function() {
    return gulp.src(paths.assets + 'images/**/*.+(png|jpg|gif|jpeg)')
        .pipe(image())
        .pipe(gulp.dest(paths.dist + 'images'));
});

I'm on OS X 10.11.5 running node v6.2.2.

Don't work - Error [ERR_REQUIRE_ESM]: Must use import to load ES Module

$ gulp
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ...\06_test_Gulp\node_modules\gulp-image\index.js
require() of ES modules is not supported.
require() of ...\06_test_Gulp\node_modules\gulp-image\index.js from ...\06_test_Gulp\gulpfile.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from ...\06_test_Gulp\node_modules\gulp-image\package.json.

at new NodeError (node:internal/errors:363:5)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1126:13)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (...\06_test_Gulp\gulpfile.js:7:15)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32) {

code: 'ERR_REQUIRE_ESM'
}

it doesn't compress

Hi,

This error shows up when i try to compress an image: off.png

Any help!?

Thanks,

`{ [Error: Command failed: /Users/jabersalehi/Dropbox/doctor-lebas/admin/node_modules/gulp-image/node_modules/zopflipng-bin/vendor/zopflipng -y --lossy_8bit --lossy_transparent /var/folders/h0/jl9h196n3q91zv534jt_w8t00000gn/T/3053d46d-ed88-487f-8711-094502d1e9ce /var/folders/h0/jl9h196n3q91zv534jt_w8t00000gn/T/9ea95c5b-d873-41cc-b193-6b97aa4e1e5b
Optimizing /var/folders/h0/jl9h196n3q91zv534jt_w8t00000gn/T/3053d46d-ed88-487f-8711-094502d1e9ce
Encoding error 82: color conversion to palette requested while a color isn't in palette
Decoding error 82: color conversion to palette requested while a color isn't in palette
There was an error

]
killed: false,
code: 1,
signal: null,
cmd: '/Users/jabersalehi/Dropbox/doctor-lebas/admin/node_modules/gulp-image/node_modules/zopflipng-bin/vendor/zopflipng -y --lossy_8bit --lossy_transparent /var/folders/h0/jl9h196n3q91zv534jt_w8t00000gn/T/3053d46d-ed88-487f-8711-094502d1e9ce /var/folders/h0/jl9h196n3q91zv534jt_w8t00000gn/T/9ea95c5b-d873-41cc-b193-6b97aa4e1e5b',
stdout: 'Optimizing /var/folders/h0/jl9h196n3q91zv534jt_w8t00000gn/T/3053d46d-ed88-487f-8711-094502d1e9ce\nEncoding error 82: color conversion to palette requested while a color isn't in palette\nDecoding error 82: color conversion to palette requested while a color isn't in palette\nThere was an error\n\n',
stderr: '' }`

Error: write EPIPE

I was using gulp-imagemin before, which worked perfectly, but wanted to give gulp-image a try. But it's failing with a strange error.

$ gulp image
[07:07:05] Using gulpfile /Volumes/Dev/Web/Node.js/NoobGuy/gulpfile.js
[07:07:05] Starting 'image'...
[07:07:05] Finished 'image' after 14 ms
Error: write EPIPE
    at exports._errnoException (util.js:907:11)
    at WriteWrap.afterWrite (net.js:785:14)

Here's what I have in my gulpfile.js

var image = require('gulp-image');
gulp.task('image', function(){
    gulp.src('./public/assets/images/**/*',{'base':'./public/assets/images/'})
        .pipe(image())
        .pipe(gulp.dest('./public/assets/dist/images'));
});

I was using the same code with gulp-imagemin which worked properly. Am I doing something wrong?

Strange behaviour

@1000ch

Hi I have a gulp tasks and it is working fine for me in UBUNTU environment:-


gulp.task('build-image', function () {
    gulp.src(input.image)
        //Commented for development
        //.pipe(changed(input.imageChanged))
        .pipe(image())
        .pipe(gulp.dest(output + '/img'));
});

here is the output

[12:34:34] ✔ flags/tj.png -> before=496 B after=358 B reduced=138 B(27.8%)                                     
[12:34:34] ✔ flags/tv.png -> before=536 B after=421 B reduced=115 B(21.5%)                                     
[12:34:34] ✔ flags/tw.png -> before=465 B after=326 B reduced=139 B(29.9%)                                     
[12:34:34] ✔ flags/ua.png -> before=446 B after=297 B reduced=149 B(33.4%)                                     
[12:34:34] ✔ flags/ug.png -> before=531 B after=375 B reduced=156 B(29.4%)                                     
[12:34:34] ✔ flags/um.png -> before=571 B after=448 B reduced=123 B(21.5%)                                     
[12:34:34] ✔ flags/us.png -> before=609 B after=460 B reduced=149 B(24.5%)                                     
[12:34:34] ✔ flags/tt.png -> before=617 B after=463 B reduced=154 B(25%)                                       
[12:34:34] ✔ flags/tz.png -> before=642 B after=492 B reduced=150 B(23.4%)                                     
[12:34:34] ✔ flags/to.png -> before=426 B after=293 B reduced=133 B(31.2%)                                     
[12:34:34] ✔ flags/tr.png -> before=492 B after=363 B reduced=129 B(26.2%)                                     
[12:34:34] ✔ flags/tm.png -> before=593 B after=437 B reduced=156 B(26.3%)                                     
[12:34:34] ✔ flags/tn.png -> before=495 B after=360 B reduced=135 B(27.3%)                                     
[12:34:35] ✔ flags/vc.png -> before=577 B after=402 B reduced=175 B(30.3%)                                     
[12:34:35] ✔ flags/uy.png -> before=532 B after=399 B reduced=133 B(25%)                                       
[12:34:35] ✔ flags/uz.png -> before=515 B after=392 B reduced=123 B(23.9%)                                     
[12:34:35] ✔ flags/va.png -> before=553 B after=403 B reduced=150 B(27.1%)                                     
[12:34:35] ✔ flags/ws.png -> before=476 B after=345 B reduced=131 B(27.5%)                                     
[12:34:35] ✔ flags/xk.png -> before=15.07 KB after=466 B reduced=14.61 KB(97%)                                 
[12:34:35] ✔ flags/ye.png -> before=413 B after=292 B reduced=121 B(29.3%)                                     
[12:34:35] ✔ flags/yt.png -> before=593 B after=445 B reduced=148 B(25%)                                       
[12:34:35] ✔ flags/za.png -> before=642 B after=501 B reduced=141 B(22%)                                       
[12:34:35] ✔ flags/wales.png -> before=652 B after=530 B reduced=122 B(18.7%)                                  
[12:34:35] ✔ flags/vn.png -> before=474 B after=312 B reduced=162 B(34.2%)                                     
[12:34:35] ✔ flags/wf.png -> before=554 B after=431 B reduced=123 B(22.2%)                                     
[12:34:35] ✔ flags/ve.png -> before=528 B after=385 B reduced=143 B(27.1%)                                     
[12:34:35] ✔ flags/vu.png -> before=604 B after=430 B reduced=174 B(28.8%)                                     
[12:34:35] ✔ flags/vi.png -> before=616 B after=508 B reduced=108 B(17.5%)                                     
[12:34:35] ✔ flags/zm.png -> before=500 B after=353 B reduced=147 B(29.4%)                                     
[12:34:35] ✔ flags/vg.png -> before=630 B after=487 B reduced=143 B(22.7%)                                     
[12:34:35] ✔ flags/zw.png -> before=574 B after=440 B reduced=134 B(23.3%)

But to be very strange same task skips some images on WINDOW environment

Am I doing something wrong ?

I would greatly appreciate it if you kindly give me some feedback on this

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:

version :

node --version
v14.18.2 
npm --version 
8.1.3
gulp-image --version 
^6.3.1"

run gulp and error output

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/metapodcod/Work/blog/node_modules/gulp-image/index.js
require() of ES modules is not supported.
require() of /home/metapodcod/Work/blog/node_modules/gulp-image/index.js from /home/metapodcod/Work/blog/gulpfile.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/metapodcod/Work/blog/node_modules/gulp-image/package.json.

    at new NodeError (internal/errors.js:322:7)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/home/metapodcod/Work/blog/gulpfile.js:6:11)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  code: 'ERR_REQUIRE_ESM'
}

Files that are larger are overwritten

In the case that gulp-image actually leave the file larger than it started, it saves the larger version regardless. Surely just use the original file if we are unable to improve on it?

Unhandled Promise Rejection Warning

Hey I'm getting this error when trying to execute the function

gulp.task("image", () => { gulp.src("./site/static/img/*") .pipe(image({ guetzli: true, options: { guetzli: ["--quality", 85] } })) .pipe(gulp.dest("dist/img")); });

Another node module works so I know the directories are correct. The exact error is:
(node:10378) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): [object Object] (node:10378) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non -zero exit code. (node:10378) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): [object Object]

PNG

what parameters should i adjust to increase the png compression.

Thanks!

require('jpegoptim-bin').path is undefined

{ name: 'jpegoptim',
  path: undefined,
  args:
   [ '--override',
     '--strip-all',
     '--strip-iptc',
     '--strip-icc',
     '--all-progressive',
     '/tmp/b06f6625-c155-4d64-8dd4-f94c0049fce3/allbgs.png' ] }

with [email protected]

I found require('pegoptim-bin') is the correct value

Npm install error

Hello. I have a file package.json
with code
{ "devDependencies": { "autoprefixer": "^9.7.3", "browser-sync": "^2.26.7", "gulp": "^4.0.2", "gulp-image": "^5.1.0", "gulp-jshint": "^2.1.0", "gulp-newer": "^1.4.0", "gulp-postcss": "^8.0.0", "gulp-sass": "^4.0.2", "gulp-sourcemaps": "^2.6.5", "jshint": "^2.10.3" } }

Everything installs correctly with npm install cammand, except 'gulp-image'

the following error appears:

http://joxi.ru/5md5dW0fevoMP2

http://joxi.ru/L2149jvUg6Qpkm

http://joxi.ru/RmzN9gecRWkz9m

installed ver. of nodejs is 12.13.1
gulp ver. 4.0.2

Tell me what could be the problem? thank you

JPGs are not compressed

Hello, before opening this issue I read other ones that were closed, like #8, and tried the fixes suggested. Unfortunately, I couldn't solve my problem.

gulp-image` is compressing png files without any flaw but when it comes to the jpg format, it leaves them as they are. If it is of any help, here it is my configuration:

var gulp = require('gulp');
var image = require("gulp-image");
var imagemin = require('gulp-imagemin');
var jpegRecompress = require("imagemin-jpeg-recompress");
var mozjpeg = require("imagemin-mozjpeg");
var jpegoptim = require('jpegoptim-bin');


// Optimization tasks
// -------------------

gulp.task("images:minify", function () {
    return gulp.src("images_src/**/*")
        .pipe(imagemin([imageminMozJpeg()], {
            verbose: true
        }))
        .pipe(gulp.dest("images_src/compressed"));
});

gulp.task("images:compress", function () {
    gulp.src("images_src/**/*.*")
    .pipe(image({
        jpegRecompress: true,
        jpegoptim: false,
        mozjpeg: true,
        concurrent: 10
    }))
    .pipe(gulp.dest("tmp"));
})

And here's what the terminal outputs when I try to run the task
screenshot from 2018-01-04 12-39-03

Could you please help me?

Install of Guetzli error

A great gulp plug-in. I've used it a-lot over the last 2 years.

Just running into this issue after I've tried to start using gulp-image of the last week. There is to be an error for Guetzli, not installing correctly

I've tried completely removing all gulp file and reinstalling. Even completely removing NPM and gulp, then re-installing. Still getting the error.

I'm running a Windows 10 machine. Please see the error below:
image

All other parts of gulp-image install without issue.

Keep up the great work!

pngquant --speed does not do anything

I have this config:

	.pipe(image({
		pngquant: true,
		optipng: false,
		zopflipng: false,
		jpegRecompress: true,
		mozjpeg: false,
		guetzli: false,
		gifsicle: false,
		svgo: true,
		concurrent: 10,
		options: {
			pngquant : ['--speed=10'],
		}
	}))

Unless I am missing something, the pngquant : ['--speed=10'], does not do anything, as processing speed is the same as without this setting.

Any ideas?

Performance when optimizing hundreds of images

I'm running a task which loads a folder with a few sub folders. Total images is around 900~. My settings are to optimize only png files. As soon as the task start to run and begins optimizing images my CPU/Memory seems to sky rocket and my machine freezes. I have 16gb on this machine so wouldn't think that's a problem. Is there anyway to set images to be processed in batches?

Lots of temporary files are getting created.

Please see snapshots.

When I run it creates lots of folder

00099f67-d587-4a28-b488-2cb7ee1c4719 41ed8cf8-4fc1-4cb2-93c5-1c7c7e71306c 7a54b060-a202-4bbc-8254-fc269e30b58a d67dd2ad-db7f-42aa-bbe2-f76b7569b816 01548f6b-695d-4c13-8523-9544058fd8bc 42011619-9957-473e-91cb-914c1f9a1925 7e03b06b-d018-4654-befe-c309672ec6ea d684a64e-0d8f-4372-85b3-85eeef032b41 060b81da-f4b9-4d02-9e8c-2125c692a394 4244c9ad-27c8-40fb-a3e9-5aa27ae981c4 7e4208cb-b5b1-479f-8671-8c69c8bc4a9d d6dad8e0-ffb3-4eb1-8662-7daad86c7ab5 0b4fe47d-78c5-4422-ab36-71b575764691 430c802c-730b-4fc5-af08-625a96a0c93d 7f181495-1306-453d-89df-f0ab5ebce48e d8a5396c-a574-4922-934b-76f66aaecebb 0b62ac0a-8fef-4e45-a549-f590976d766c 462d0e5b-b9b7-4627-8872-f23682560c76 812e8f3d-7280-4ac8-bee5-34a22ff47a4a d8ea7bdd-d23e-4197-a18d-6d7eedb121d0 0c748e3f-ec99-4491-935b-c16222eb8a65 48b97430-fbf5-49c7-bba4-ed078abcc204 8773e1ae-f655-4144-800d-d9bd6b8a04fc dad7c443-c77d-4e5f-92c8-f337c4bb9960 0c8071c8-860e-40d8-ab14-c9d63c90d81f 493f5b6d-e0a0-4a7f-82e1-7545ea5e4063 88454eb7-c7cd-49f9-b786-06b81ef79eab dd474191-a37b-49a1-8237-d6f3d0056ca9 0eedacff-45ae-4ceb-8f9c-3ed9c09e248d 49d2f09a-0077-42d2-8302-f7a630ea2052 8c2fbe1f-982c-46b7-9caa-dcdefb56d779 dd594638-8a16-46f4-9d50-1c07163722c2 0fb1d757-5c69-49a1-88a2-c95b8c10ca01

gulp.task('image', function () { gulp.src('./app/static/images/**/*.png') //.pipe(image()) //todo - is creating many temporary folders, find out why? .pipe(gulp.dest('./dist/static/images')); });

I am running it in docker container on top of nodejs image.

stdout maxBuffer exceeded

Version: [email protected]

When trying to compress this image: https://unsplash.com/photos/XJXWbfSo2f0
(File size: 20.505KB)
I have this error:
(node:10064) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error in plugin 'gulp-image' Message: stdout maxBuffer exceeded Details: stream: stdout (node:10064) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Encountered bug while install in Mac.

error:

> [email protected] postinstall /Users/abc/work/HTML5GameEngine/node_modules/jpeg-recompress-bin
> node lib/install.js

  ✔ jpeg-recompress pre-build test passed successfully

> [email protected] postinstall /Users/abc/work/HTML5GameEngine/node_modules/jpegoptim-bin
> node lib/install.js

  ⚠ The `/Users/abc/work/HTML5GameEngine/node_modules/jpegoptim-bin/vendor/jpegoptim` binary doesn't seem to work correctly
  ⚠ jpegoptim pre-build test failed
  ℹ compiling from source
  ✖ Error: ./configure --prefix="/Users/abc/work/HTML5GameEngine/node_modules/jpegoptim-bin/vendor" --bindir="/Users/abc/work/HTML5GameEngine/node_modules/jpegoptim-bin/vendor" && make install
Command failed: ./configure --prefix="/Users/abc/work/HTML5GameEngine/node_modules/jpegoptim-bin/vendor" --bindir="/Users/abc/work/HTML5GameEngine/node_modules/jpegoptim-bin/vendor"

    at ChildProcess.exithandler (child_process.js:202:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:492:12)

> [email protected] postinstall /Users/abc/work/HTML5GameEngine/node_modules/mozjpeg
> node lib/install.js

  ⚠ The `/Users/abc/work/HTML5GameEngine/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
  ⚠ mozjpeg pre-build test failed
  ℹ compiling from source
  ✖ Error: autoreconf -fiv && ./configure --disable-shared --prefix="/Users/abc/work/HTML5GameEngine/node_modules/mozjpeg/vendor" --bindir="/Users/abc/work/HTML5GameEngine/node_modules/mozjpeg/vendor" --libdir="/Users/abc/work/HTML5GameEngine/node_modules/mozjpeg/vendor" && make --jobs=8 && make install --jobs=8
Command failed: ./configure --disable-shared --prefix="/Users/abc/work/HTML5GameEngine/node_modules/mozjpeg/vendor" --bindir="/Users/abc/work/HTML5GameEngine/node_modules/mozjpeg/vendor" --libdir="/Users/abc/work/HTML5GameEngine/node_modules/mozjpeg/vendor"
configure: error: installation or configuration problem: assembler cannot create object files.

    at ChildProcess.exithandler (child_process.js:202:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:850:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

OS X (10.11.5 (15F34))
node v6.2.0

any idea?

thanks.

error after updating dependencies

npm i -D gulp-image

npm ERR! code 1
npm ERR! path D:\methed-project-web\06-bonus\06-gulp-final\node_modules\gulp-image\node_modules\gifsicle
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node lib/install.js
npm ERR! compiling from source
npm ERR! Response code 404 (Not Found)
npm ERR! gifsicle pre-build test failed
npm ERR! Error: Command failed: C:\Windows\system32\cmd.exe /s /c "autoreconf -ivf"
npm ERR! "autoreconf" �� ���� ����७��� ��� ���譥�
npm ERR! ��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.
npm ERR!
npm ERR!
npm ERR! at D:\methed-project-web\06-bonus\06-gulp-final\node_modules\execa\index.js:231:11
npm ERR! at processTicksAndRejections (internal/process/task_queues.js:95:5)
npm ERR! at async Promise.all (index 0)

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Quper\AppData\Local\npm-cache_logs\2021-11-23T18_21_49_179Z-debug.log

log
2021-11-23T18_21_49_179Z-debug.log

jpeg

jpeg 图片可以指定压缩率么,感觉图片都模糊了

NPM 5.6.0 can't install gulp-image

Hi!
I have a problem with the gulp-image.
I can't install that with npm 5.6.0.

MacBook-Air:t2 Acrob$ sudo npm i
Password:

> [email protected] postinstall /Users/Acrob/dev/t2/node_modules/gifsicle
> node lib/install.js

  ⚠ EACCES: permission denied, mkdir '/Users/Acrob/dev/t2/node_modules/gifsicle/vendor'
  ⚠ gifsicle pre-build test failed
  ℹ compiling from source
/Users/Acrob/dev/t2/node_modules/onetime/index.js:15
				throw new Error(fnName + ' can only be called once.');
				^

Error: callback() can only be called once.
    at onetime (/Users/Acrob/dev/t2/node_modules/onetime/index.js:15:11)
    at /Users/Acrob/dev/t2/node_modules/download/index.js:156:5
    at ConcatStream.<anonymous> (/Users/Acrob/dev/t2/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:111:20)
    at ConcatStream.emit (events.js:208:7)
    at finishMaybe (/Users/Acrob/dev/t2/node_modules/readable-stream/lib/_stream_writable.js:620:14)
    at endWritable (/Users/Acrob/dev/t2/node_modules/readable-stream/lib/_stream_writable.js:628:3)
    at ConcatStream.Writable.end (/Users/Acrob/dev/t2/node_modules/readable-stream/lib/_stream_writable.js:584:41)
    at DuplexWrapper.onend (/Users/Acrob/dev/t2/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (events.js:313:30)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Acrob/.npm/_logs/2018-02-22T08_29_04_672Z-debug.log

withMetadata

An option for controlling MetaData would be very good. Is there a possibility?

Can't change quality setting for mozjpeg

I am trying to set quality setting for the mozjpeg module however struggling to do so. According to their documentation the -quality flag can be used with a value from 0 to 100. I am attempting to do something like the below, however I'm not sure if I'm misreading your own documentation and using options incorrectly.

.image({
    pngquant: true,
    optipng: false,
    zopflipng: false,
    jpegRecompress: false,
    mozjpeg: true,
    guetzli: false,
    gifsicle: true,
    svgo: true,
    concurrent: 10,
    quiet: true,
    options: {
        mozjpeg: ['-quality', 60],
    }
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.