# gulp-image

> Optimize PNG, JPG, GIF, SVG images with gulp task.

Latest version **6.3.1** (published 2021-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-image
pnpm add gulp-image
yarn add gulp-image
bun add gulp-image
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.3.1 |
| Published | 2021-12-01 |
| First published | 2014-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/gulp-image) |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 18 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 222 |
| Author | Shogo Sensui |
| Maintainers | 1000ch |
| Keywords | compress, minify, optimize, image, img, jpg, jpeg, png, gif, svg, gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-image
- Repository: https://github.com/1000ch/gulp-image
- Homepage: https://github.com/1000ch/gulp-image#readme
- Issues: https://github.com/1000ch/gulp-image/issues
- npm.io page: https://npm.io/package/gulp-image

## Dependencies (18)

- [svgo](https://npm.io/package/svgo.md) ^2.8.0
- [is-gif](https://npm.io/package/is-gif.md) ^4.0.1
- [is-jpg](https://npm.io/package/is-jpg.md) ^3.0.0
- [is-png](https://npm.io/package/is-png.md) ^3.0.1
- [is-svg](https://npm.io/package/is-svg.md) ^4.3.2
- [mozjpeg](https://npm.io/package/mozjpeg.md) ^8.0.0
- [round10](https://npm.io/package/round10.md) ^1.0.3
- [gifsicle](https://npm.io/package/gifsicle.md) ^6.1.0
- [fancy-log](https://npm.io/package/fancy-log.md) ^1.3.3
- [ansi-colors](https://npm.io/package/ansi-colors.md) ^4.1.1
- [exec-buffer](https://npm.io/package/exec-buffer.md) ^3.2.0
- [optipng-bin](https://npm.io/package/optipng-bin.md) ^8.1.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.1
- [pngquant-bin](https://npm.io/package/pngquant-bin.md) ^7.0.2
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^5.6.0
- [zopflipng-bin](https://npm.io/package/zopflipng-bin.md) ^7.1.0
- [jpeg-recompress-bin](https://npm.io/package/jpeg-recompress-bin.md) ^6.0.1
- [through2-concurrent](https://npm.io/package/through2-concurrent.md) ^2.0.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 6.3.1 (latest) — 2021-12-01
- 6.3.0 — 2021-11-29
- 6.2.1 — 2020-07-17
- 6.2.0 — 2020-05-31
- 6.1.0 — 2020-03-12
- 6.0.0 — 2019-12-27
- 5.1.0 — 2019-06-08
- 5.0.0 — 2019-05-26
- 4.4.1 — 2018-12-02
- 4.4.0 — 2018-11-17
- 4.3.0 — 2018-02-09
- 4.2.0 — 2017-12-28
- 4.1.0 — 2017-11-05
- 4.0.0 — 2017-10-07
- 3.0.0 — 2017-09-03
- … 69 more at https://npm.io/package/gulp-image/versions

## README

# gulp-image ![GitHub Actions Status](https://github.com/1000ch/gulp-image/workflows/test/badge.svg?branch=main)

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

![gulp-image result](https://raw.github.com/1000ch/gulp-image/master/screenshot/terminal.png)

## Install

```bash
$ npm install --save-dev gulp-image
```

### External Dendencies

- `brew install libjpeg libpng` on macOS
- `apt-get install -y libjpeg libpng` on Ubuntu
- `npm install -g windows-build-tools` on Windows

## Usage

This is an example of `gulpfile.js`.

```javascript
import gulp from 'gulp';
import image from 'gulp-image';

gulp.task('image', function () {
  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:

```javascript
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:

```javascript
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: ['--enable', 'cleanupIDs', '--disable', 'convertColors']
    }))
    .pipe(gulp.dest('./dest'));
});
```

## License

[MIT](https://1000ch.mit-license.org) © [Shogo Sensui](https://github.com/1000ch)

---
_Source: https://npm.io/package/gulp-image · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
