This is Imagecram - a tool to quickly and easily compress images straight from your command line.
Compression is currently handled using the really powerful TinyPNG service.
Features • Install • Usage • Contributing
Provide a single image file or multiple image files to be compressed.
Instead of file paths, specify using a regex. E.g. *.png
to compress all PNGs in the current folder.
Provide the output file or folder to write the compressed file(s) to.
Imagecram can be easily installed using Swift Package Manager.
git clone https://github.com/lordcodes/imagecram
cd imagecram
swift run task install
It can be uninstalled later using: swift run task uninstall
.
Imagecram can be installed using Mint.
mint install lordcodes/imagecram
Support for Homebrew is planned.
USAGE: imagecram [<inputs> ...] [--output <output>] [--version] [--quiet]
ARGUMENTS:
<inputs> One or more input image files
OPTIONS:
-o, --output <output> Output image file or directory
-v, --version Output the version number
-q, --quiet Silence any output except errors
-h, --help Show help information.
On first run, you will be asked for your TinyPNG API key, which will be stored on your system for future runs.
If you already have a TinyPNG account you can get the API key from your account dashboard.
If you don't have an account yet it only takes a few seconds to get one from the TinyPNG website.
imagecram article-header.png
imagecram one.jpg two.png three.png
imagecram ~/Downloads/*.png
imagecram old.png -o new.png
imagecram *.png -o compressed
The plan is to implement image compression within the tool itself to remove the restriction of providing a TinyPNG API key and being limited on how many images they will compress for free each month. There is currently no time-frame on this and it will depend on simplicity and how effectively it compresses the images.
If you notice any bugs or have a new feature to suggest, please check out the contributing guide. If you want to make changes, please make sure to discuss anything big before putting in the effort of creating the PR.
To reach out, please contact @lordcodes on Twitter.