a simple image compressing tool with tinypng

Usage no npm install needed!

<script type="module">
  import easytiny from 'https://cdn.skypack.dev/easytiny';


easytiny is a simple CLI for compressing jpg/png images by tinypng api.


Prerequisites: Node.js (>=7.x preferred), npm version 3+ and Git.

$ npm install -g easytiny


Set your tinypng api key. Get your api key by visiting tinypng, 500 images limited every month, but you can register more api keys.

$ easytiny config set key XXXX-XXXX-XXXXXXXXXXXX

Set Proxy

$ easytiny config set proxy http://user:pass@


Run with default mode, no resize and compressed images output into a new easytiny folder with a timestamp

$ easytiny start

Run with overwrite mode, the original images will be overwritten by compressed images

$ easytiny start --overwrite

shorthand for overwrite mode

$ easytiny start -o

Run with resize mode, images will be resized before compressing

$ easytiny start --resize

shorthand for resize mode

$ easytiny start -r

There are three methed for resizing, scalefitcover. You can learn more here.

  • scale

Scales the image down proportionally. You must provide either a target width or a target height, but not both. The scaled image will have exactly the provided width or height.

  • fit

Scales the image down proportionally so that it fits within the given dimensions. You must provide both a width and a height. The scaled image will not exceed either of these dimensions.

  • cover

Scales the image proportionally and crops it if necessary so that the result has exactly the given dimensions. You must provide both a width and a height. Which parts of the image are cropped away is determined automatically. An intelligent algorithm determines the most important areas and leaves these intact.

Overwrite mode and resize mode can be joined together.

$ easytiny start -ro


Get the main help.

$ easytiny -h

Get the detail help.

$ easytiny start -h
$ easytiny config -h