Skip to content

Image transformation commands

Giorgio Garofalo edited this page Jan 29, 2024 · 16 revisions

This page is work in progress!

Contents:

Note: all of the commands below produce an image output which, by default, is named after the source image followed by a tag.
The output file can be manually set to any file by using --imgoutput=path, which can also be used to chain two or more of the following commands when --chainoutput is enabled.

Recolorize

Command: recolorize[=method]

Description:
Creates a copy of the source image (that relies on the default scheme) and adapts it to a custom scheme.

Arguments:

  • method: defines what color should be used in case some properties have more than one color (e.g. whitespace=FFFFFF,FF0000).
    It can be either first (default), last or random;

Properties needed:

  • source: image to recolorize;
  • colors: custom scheme that should be applied;
  • lib (optional): library files used.

Example:
to do

Standardize

Command: standardize

Description:
Creates a copy of the source image (that relies on a custom scheme) and adapts it to the default scheme.

Properties needed:

  • source: image to recolorize;
  • colors: custom scheme used by the source image;
  • lib (optional): library files used.

Example:
to do

Compact

Command: compact[=size]

Description:
Creates a copy of the source image where pixels are one next to another, except for line breaks, without any whitespace between them.

Arguments:

  • size: size (in pixels) of the output image. If not specified, the program will pick a proper size that minimizes whitespaces.
    The argument is defined via w?h?, where both w and h are optional (in case one is missing, it will be calculated the same way as before)
    For example: w10h5 = 10 x 5, w10 = 10 x auto, h5 = auto x 5);

Properties needed:

  • source: image to compact;
  • colors: scheme used, only needed to detect whitespaces;

Example:
to do

Decompact

Command: decompact

Description:
Creates a copy of the source image with one statement per line, including empty lines that separate blocks in order to improve readability.

Properties needed:

  • source: image to decompact;
  • colors: scheme used;

Standardize + decompact

Command: standardecompact

Description:
Runs standardize and decompact.

Properties needed:

  • source: image to standardize and decompact;
  • colors: custom scheme used by the source image;
  • lib (optional): library files used.

Color swap

Command: colorswap=<swaps>

Description:
Replaces certain colors with others.

Arguments:

  • swaps: a list of pairs OLD:NEW, separated by a comma, where OLD is the color to be replaced and NEW is the color to set, both as hexadecimal values. For example: FF0000:FFFF00,00FF00:0000FF replaces red with yellow and green with blue.

Properties needed:

  • source: image to affect.

Mask

Command: -mask=<mask path>

Description:
Applies a 'shape' mask to the source image without altering its content.

Arguments:

  • mask path: path to an image that generates the shape mask. A mask image has a transparent background with solid pixels where the actual shape is.

Note: the amount of pixels of the source image has to match the amount of solid pixels of the mask image.

Properties needed:

  • source: image to mask.