Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - imagemin/imagemin: [Unmaintained] Minify images seamlessly

[Unmaintained] Minify images seamlessly. Contribute to imagemin/imagemin development by creating an account on GitHub.

Visit SiteGitHub - imagemin/imagemin: [Unmaintained] Minify images seamlessly

GitHub - imagemin/imagemin: [Unmaintained] Minify images seamlessly

[Unmaintained] Minify images seamlessly. Contribute to imagemin/imagemin development by creating an account on GitHub.

Powered by 0x5a.live ๐Ÿ’—

imagemin

Minify images seamlessly

Install

npm install imagemin

Usage

import imagemin from 'imagemin';
import imageminJpegtran from 'imagemin-jpegtran';
import imageminPngquant from 'imagemin-pngquant';

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

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

API

imagemin(input, options?)

Returns Promise<object[]> in the format {data: Uint8Array, 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

The plugins to use.

glob

Type: boolean
Default: true

Enable globbing when matching file paths.

imagemin.buffer(data, options?)

Returns Promise<Uint8Array>.

data

Type: Uint8Array

The image data to optimize.

options

Type: object

plugins

Type: Array

Plugins to use.

Related

NodeJS Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.