Skip to content
A thin wrapper around `imagemin` to compress images.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore First version, v0.1.0 Jul 30, 2019
README.md First version, v0.1.0 Jul 30, 2019
main.js
package.json First version, v0.1.0 Jul 30, 2019
yarn.lock First version, v0.1.0 Jul 30, 2019

README.md

oimg

A thin wrapper around imagemin to compress images.

Find the target

First, we need to find the images which need to be compressed.

I didn't implement this function in this tool, because some simple and elegant shell pipes can do the job.

# fd is the modern version of find
# bat is the modern version of cat
fd -e png -e jpeg -e jpg -e svg '' . |\
xargs ls -l |\
sort -nk5 -r |\
awk '{print $9,$5}' |\
numfmt --field=2 --to=iec |\
column -t | bat

Install

yarn global add oimg.

Usage

file could be a specific file or a glob, like images/*.jpg.

oimg [flags] file...

Options:
  --webp              whether or not to convert jpgs and pngs to webp
                                                                [default: false]
  -h, --help          Show help                                        [boolean]
  -v, --version       Show version number                              [boolean]
  --output                                                     [default: "dist"]
  --jpg-quality                                                    [default: 70]
  --png-quality                                            [default: "0.65,0.8"]
  --webp-jpg-quality                                               [default: 75]
  --webp-png-quality                                               [default: 85]
You can’t perform that action at this time.