imagemin

WebJar for imagemin

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

imagemin
Last Version

Last Version

5.2.2
Release Date

Release Date

Type

Type

jar
Description

Description

imagemin
WebJar for imagemin
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/imagemin/imagemin

Download imagemin

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/imagemin/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>imagemin</artifactId>
    <version>5.2.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/imagemin/
implementation 'org.webjars.npm:imagemin:5.2.2'
// https://jarcasting.com/artifacts/org.webjars.npm/imagemin/
implementation ("org.webjars.npm:imagemin:5.2.2")
'org.webjars.npm:imagemin:jar:5.2.2'
<dependency org="org.webjars.npm" name="imagemin" rev="5.2.2">
  <artifact name="imagemin" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='imagemin', version='5.2.2')
)
libraryDependencies += "org.webjars.npm" % "imagemin" % "5.2.2"
[org.webjars.npm/imagemin "5.2.2"]

Dependencies

compile (6)

Group / Artifact Type Version
org.webjars.npm » promise.pipe jar [3.0.0,4)
org.webjars.npm : file-type jar [3.8.0,4)
org.webjars.npm : replace-ext jar 0.0.1
org.webjars.npm : pify jar [2.3.0,3)
org.webjars.npm : globby jar [5.0.0,6)
org.webjars.npm : mkdirp jar [0.5.1,0.6)

Project Modules

There are no modules declared in this project.

imagemin Build Status

Minify images seamlessly





Install

$ npm install imagemin

Usage

const imagemin = require('imagemin');
const imageminJpegtran = require('imagemin-jpegtran');
const imageminPngquant = require('imagemin-pngquant');

(async () => {
	const files = await imagemin(['images/*.{jpg,png}'], {
		destination: 'build/images',
		plugins: [
			imageminJpegtran(),
			imageminPngquant({
				quality: [0.6, 0.8]
			})
		]
	});

	console.log(files);
	//=> [{data: <Buffer 89 50 4e …>, destinationPath: 'build/images/foo.jpg'}, …]
})();

API

imagemin(input, options?)

Returns Promise<object[]> in the format {data: Buffer, sourcePath: string, destinationPath: string}.

input

Type: string[]

File paths or glob patterns.

options

Type: object

destination

Type: string

Set the destination folder to where your files will be written. If no destination is specified, no files will be written.

plugins

Type: Array

Plugins to use.

glob

Type: boolean
Default: true

Enable globbing when matching file paths.

imagemin.buffer(buffer, options?)

Returns Promise<Buffer>.

buffer

Type: Buffer

Buffer to optimize.

options

Type: object

plugins

Type: Array

Plugins to use.

Hosted API

We also provide a hosted API for imagemin which may simplify your use case.

Related

org.webjars.npm

imagemin

Versions

Version
5.2.2