KRAKER

Image optimalisation tool using Kraken.io API

How to use:

Usage: ./kraker [options]

Specific options:
    -i, --input INPUT                Location of the input image or input folder with multiple images.
    -o, --output OUTPUT              Location where to save optimised images.
    -l, --lossy                      Select to optimise images with lossy optimization. Typically produces savings of at least 60%
    -x, --lossless                   Select to optimise images with lossless optimization.
    -r, --resize                     Set if resize of the image is desired.
        --width WIDTH                Enter witdth of the resulting image in pixels.
        --height HEIGHT              Enter height of the resulting image in pixels.
        --strategy STRATEGY          Select desired strategy for image resizing.
    -c, --convert                    Set if converting image is desired.
        --format FORMAT              Enter format of the resulting image. Suppoered formats: jpeg, png & gif
        --background                 The background property can be passed in HEX notation, RGB & RGBA.
        --keep-extension             Keep the original file extension intact regardless of the output image format.
    -d, --debug                      Debug mode on.
    -h, --help                       Display this help information.


Resizing strategies:
    - exact     => Resize to exact width and height. Aspect ratio will not be maintained.
    - fit       => This option will crop and resize your images to fit the desired width and height.
    - portrait  => Exact height will be set, width will be adjusted according to aspect ratio.
    - landscape => Exact width will be set, height will be adjusted according to aspect ratio.
    - crop      => This option will crop your images to the exact size you specify with no distortion.
    - square    => This strategy will first crop the image by its shorter dimension to make it a square, then resize it to the specified size.
    - auto      => The best strategy (portrait or landscape) will be selected for a given image according to its aspect ratio.

TODO:

  • !!! tests for existing functionality !!!
  • results printed out not using logger
  • possibility to turn off logging and just see progress bar
  • multythreading

FUTURE TODO:

  • Option to delete original files
  • Do not dump all file into one dir but rather create "opt" equivalent of the input directory and file structure

LICENSE - MIT

Copyright (c) 2016 Jakub Zak, jakub.zak@me.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.