Swiftpack.co - lordcodes/imagecram as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by lordcodes.
lordcodes/imagecram v0.1.0
A command line tool to quickly and easily compress images
⭐️ 7
🕓 2 years ago
.package(url: "https://github.com/lordcodes/imagecram.git", from: "v0.1.0")

Imagecram

Swift Package Manager Mac + Linux Latest release Twitter: @lordcodes


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.

 

FeaturesInstallUsageContributing

Features

☑️ Compress one or more images

Provide a single image file or multiple image files to be compressed.

☑️ Select images with a regex

Instead of file paths, specify using a regex. E.g. *.png to compress all PNGs in the current folder.

☑️ Specify the output location

Provide the output file or folder to write the compressed file(s) to.

Install

▶︎ Swift Package Manager

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.

▶︎ Mint

Imagecram can be installed using Mint.

mint install lordcodes/imagecram

▶︎ Homebrew

Support for Homebrew is planned.

Usage

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.

TinyPNG API key

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.

Examples

▶︎ Compress and overwrite a single image

imagecram article-header.png

▶︎ Compress and overwrite a list of images

imagecram one.jpg two.png three.png

▶︎ Compress and overwrite multiple images

imagecram ~/Downloads/*.png

▶︎ Compress and save as a new image

imagecram old.png -o new.png

▶︎ Compress multiple images and save to a folder

imagecram *.png -o compressed

Future

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.

Contributing or Help

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.

GitHub

link
Stars: 7
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v0.1.0 - Initial release
4 years ago

The first release of Imagecram.

Highlights:

  • Compress one image.
  • Compress list of images.
  • Compress images selecting using regex such as *.png.
  • Save output to a specified file or folder.
  • Provide and store TinyPNG API key for future use.
  • Tasks to lint, format, install and uninstall using SPM.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics