A command line JPG, PNG and WebP images compressor using TinyPNG API.
API key is not required.
English | Русский
- Provides up to 80% compression without noticeable quality loss
- Due to caching only changed files are uploaded to TinyPNG server
- Written in TypeScript
npm i digikid/tiny-compressor --global --install-links
Navigate to folder containing images and run command:
cd path/to/images
tiny-compressor
The processed files will be saved to /compressed
folder.
Option | Description |
---|---|
-f, --force | Compress images regardless of cache |
-p, --path | Output folder name |
-q, --quiet | Disable log |
-w, --watch | Watch for file changes |
To avoid re-compression of files and reduce requests to TinyPNG server, all processed files are cached by default.
If you want to run compression regardless of cache, pass -f
option:
tiny-compressor -f
You can change output folder name (without saving in settings) by passing -p
parameter:
tiny-compressor -p compressed-images
Notifications are generated each time files are processed. You can disable log with -q
option:
tiny-compressor -q
If you want to run compression whenever files in current folder are changed, pass -w
option:
tiny-compressor -w
Command | Description |
---|---|
config | Update settings |
help | Display usage guide |
reset | Clear cache |
stat | Print processed file history |
version | Print current package version |
Settings are saved locally and applied on all subsequent launches.
For settings update, run config
command:
tiny-compressor config
The help
command displays a help section with a list of available options and commands list:
tiny-compressor help
Use reset
command to clear processed files cache:
tiny-compressor reset
For printing processed file history use command stat
:
tiny-compressor stat
You can check installed package version with version
command:
tiny-compressor version