World Conquest Chronicles

World Conquest Chronicles

Image Preparer, v1.1.0

The utility for image preparation.

Improve resizing of images and add logging of image changes.

Change Log

  • resizing of images:
    • make resizing of images optional;
    • skip images with an allowed resolution;
  • logging of image changes:
    • logging of a change of an image resolution on resizing;
    • logging of a change of an image size:
      • on the following operations:
        • resizing;
        • optimization;
      • logging of a total change of image sizes:
        • total change after all the optimization steps;
        • total change after both resizing and optimization operations;
        • total change for all images together;
      • logging of a saved image size in percent.

Description

This is the utility for image preparation: resizing of images larger than the specified size and optimization of images in PNG format.

This is a simple script that combines several well-known tools and sets a particular mode for their running. The script also collects some statistics about the results of processing.

I use it to prepare images (screenshots and photos) for my blog.

⚠️ Warning! To avoid damaging the images or significantly degrading their quality, the script should not be run repeatedly on files that have already been processed by it.

Features

  • search of images:
    • recursive search (optionally);
    • filtering by a pattern of image filenames (uses a name pattern of the find tool);
  • resizing of images larger than the specified size with the Lanczos filter (optionally);
  • optimization of images (optionally):
  • logging of image changes:
    • logging of a change of an image resolution on resizing;
    • logging of a change of an image size:
      • on the following operations:
        • resizing;
        • optimization;
      • logging of a total change of image sizes:
        • total change after all the optimization steps;
        • total change after both resizing and optimization operations;
        • total change for all images together;
      • logging of a saved image size in percent.

Usage

$ image_preparer.bash -v | --version
$ image_preparer.bash -h | --help
$ image_preparer.bash [options] [<path>]

Options:

  • -v, --version — show the version;
  • -h, --help — show the help;
  • -n PATTERN, --name PATTERN — a pattern of image filenames (uses a name pattern of the find tool; default: *.png);
  • -r, --recursive — recursive search of images;
  • -w WIDTH, --width WIDTH — a maximum width of images (default: 640);
  • --no-resize — don't resize images;
  • --no-optimize — don't optimize images.

Arguments:

  • <path> — base path to images (default: .).

Repository

Link: https://github.com/thewizardplusplus/image-preparer/tree/v1.1.0.

Content: code.

License: MIT.