All Projects → sindresorhus → Gulp Imagemin

sindresorhus / Gulp Imagemin

Licence: mit
Minify PNG, JPEG, GIF and SVG images

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gulp Imagemin

gulp-tinypng-compress
TinyPNG API wrapper for compressing PNG & JPG images
Stars: ✭ 49 (-97.37%)
Mutual labels:  gulp-plugin, compress-images
Gulp Bro
👊 gulp + browserify + incremental build, done right.
Stars: ✭ 119 (-93.6%)
Mutual labels:  gulp-plugin
Gulp Wxa Copy Npm
微信小程序gulp插件,解决npm包管理和babel-runtime
Stars: ✭ 55 (-97.04%)
Mutual labels:  gulp-plugin
Gulp Ftp
[DEPRECATED] Upload files to an FTP-server
Stars: ✭ 100 (-94.62%)
Mutual labels:  gulp-plugin
Gulp Markdown Pdf
Markdown to PDF
Stars: ✭ 56 (-96.99%)
Mutual labels:  gulp-plugin
Gulp Flatten
Gulp plugin: remove or replace relative paths for files
Stars: ✭ 102 (-94.52%)
Mutual labels:  gulp-plugin
Generator Gulp Plugin Boilerplate
Scaffold out a Gulp plugin boilerplate
Stars: ✭ 46 (-97.53%)
Mutual labels:  gulp-plugin
Gulp Nunjucks
Precompile Nunjucks templates
Stars: ✭ 143 (-92.31%)
Mutual labels:  gulp-plugin
Gulp Modernizr
Gulp wrapper for custom Modernizr builds
Stars: ✭ 111 (-94.03%)
Mutual labels:  gulp-plugin
Gulp Babel
Gulp plugin for Babel
Stars: ✭ 1,305 (-29.84%)
Mutual labels:  gulp-plugin
Gulp Ngmin
[DEPRECATED] Pre-minify AngularJS apps with ngmin
Stars: ✭ 89 (-95.22%)
Mutual labels:  gulp-plugin
Gulp Develop Server
Development assistant for node.js server by gulp
Stars: ✭ 72 (-96.13%)
Mutual labels:  gulp-plugin
Docker Slim
DockerSlim (docker-slim): Don't change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
Stars: ✭ 11,712 (+529.68%)
Mutual labels:  minify-images
Gulp Json Editor
A gulp plugin to edit JSON objects
Stars: ✭ 55 (-97.04%)
Mutual labels:  gulp-plugin
Gulp Rev
Static asset revisioning by appending content hash to filenames: `unicorn.css` → `unicorn-d41d8cd98f.css`
Stars: ✭ 1,540 (-17.2%)
Mutual labels:  gulp-plugin
Gulp Require Tasks
Splits Gulpfile into multiple individual files
Stars: ✭ 51 (-97.26%)
Mutual labels:  gulp-plugin
Gulp Google Cdn
Replaces script references with Google CDN ones
Stars: ✭ 79 (-95.75%)
Mutual labels:  gulp-plugin
Gulp Vulcanize
Concatenate a set of Web Components into one file
Stars: ✭ 101 (-94.57%)
Mutual labels:  gulp-plugin
Gulp Stylelint
Gulp plugin for running Stylelint results through various reporters.
Stars: ✭ 149 (-91.99%)
Mutual labels:  gulp-plugin
Glup
Some of the gulp tutorial -《gulp笔记》
Stars: ✭ 136 (-92.69%)
Mutual labels:  gulp-plugin

gulp-imagemin

Minify PNG, JPEG, GIF and SVG images with imagemin

Issues with the output should be reported on the imagemin issue tracker.

Install

$ npm install --save-dev gulp-imagemin

Usage

Basic

import gulp from 'gulp';
import imagemin from 'gulp-imagemin';

export default () => (
	gulp.src('src/images/*')
		.pipe(imagemin())
		.pipe(gulp.dest('dist/images'))
);

Custom plugin options

import imagemin, {gifsicle, mozjpeg, optipng, svgo} from 'gulp-imagemin';

// …
.pipe(imagemin([
	gifsicle({interlaced: true}),
	mozjpeg({quality: 75, progressive: true}),
	optipng({optimizationLevel: 5}),
	svgo({
		plugins: [
			{
				name: 'removeViewBox',
				active: true
			},
			{
				name: 'cleanupIDs',
				active: false
			}
		]
	})
]))
// …

Custom plugin options and custom gulp-imagemin options

import imagemin, {svgo} from 'gulp-imagemin';

// …
.pipe(imagemin([
	svgo({
		plugins: [
			{
				name: 'removeViewBox',
				active: true
			}
		]
	})
], {
	verbose: true
}))
// …

API

Comes bundled with the following optimizers:

  • gifsicleCompress GIF images, lossless
  • mozjpegCompress JPEG images, lossy
  • optipngCompress PNG images, lossless
  • svgoCompress SVG images, lossless

These are bundled for convenience and most users will not need anything else.

imagemin(plugins?, options?)

Unsupported files are ignored.

plugins

Type: Array
Default: [gifsicle(), mozjpeg(), optipng(), svgo()]

Plugins to use. This will completely overwrite all the default plugins. So, if you want to use custom plugins and you need some of defaults too, then you should pass default plugins as well. Note that the default plugins come with good defaults and should be sufficient in most cases. See the individual plugins for supported options.

options

Type: object

verbose

Type: boolean
Default: false

Enabling this will log info on every image passed to gulp-imagemin:

gulp-imagemin: ✔ image1.png (already optimized)
gulp-imagemin: ✔ image2.png (saved 91 B - 0.4%)
silent

Type: boolean
Default: false

Don't log the number of images that have been minified.

You can also enable this from the command-line with the --silent flag if the option is not already specified.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].