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-linksNavigate to folder containing images and run command:
cd path/to/images
tiny-compressorThe 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 -fYou can change output folder name (without saving in settings) by passing -p parameter:
tiny-compressor -p compressed-imagesNotifications are generated each time files are processed. You can disable log with -q option:
tiny-compressor -qIf 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 configThe help command displays a help section with a list of available options and commands list:
tiny-compressor helpUse reset command to clear processed files cache:
tiny-compressor resetFor printing processed file history use command stat:
tiny-compressor statYou can check installed package version with version command:
tiny-compressor version