This tool is a cli tool for images compression which supports transform .png
to .png
or .webp
.
npm install -g imagemin-cli-lazy
-
Compress more
imgmin all
: compress all the images(support type) in the current directory, default output to themin
directory in current.imgmin all -r
: compress all the images(support type) in the current directory and sub-directory, default output to themin
directory in current.imgmin all -t webp png
: compress all the images(support type) in the current directory and transform them to.png
and.webp
, default output to themin
directory in current.
-
Compress one
imgmin one -i /path/to/image
: compress the specific path of a image, keep it's suffix, default output to themin
directory in current.imgmin one -i /path/to/image -o ./images
: compress the specific path of a image, keep it's suffix, output to theimages
directory in current.imgmin one -i /path/to/image.png -t webp png
: compress the specific path of a image, transform to.png
and.webp
, default output to themin
directory in current.
In common case, the default setting can almost fit the compression jobs, but if you want to improve the quality of the images, there is a way:
- when transform to
.png
, add the setting-pq min max
, where min and max are between 0 and 1, this means it will use the least amount of colors required to meet or exceed the max quality. If conversion results in quality below the min quality the image won't be saved, default0.6 0.8
.
imgmin one -i /path/to/image -t png -pq 0.8 0.9
- when transform to
.webp
, add the setting-wq quality
, where quality between 0(worst) and 1(best), default0.75
.
imgmin all -t png webp -pq 0.8 0.9 -wq 0.9
- support to input
.png
- support to transform to
.png
and.webp