## Miscellaneous Tools

### random-ellipses

Generates random grayscale ellipses in a new layer.

The background of the layer is 50% gray, and ellipses contain a linear gradient.

• In ellipses with a size above average, the gradient goes from 50% gray to white
• In ellipses with a size below average, the gradient goes from 50% gray to a lighter gray proportional to the ellipse size, e.g. the gradient in a half size ellipse will go from 50% gray to 75% gray. In other words, if the layer is used as a bumpmap, all the ellipses smaller than the average will have a height proportional to their size and produce the same slopes.

When two ellipses overlap, the lighter tone is kept.

#### Options:

##### Density

The percent of area covered by ellipes

##### Overlap

Whether the ellipses can overlap or not.

##### Average size

The average diameter of the ellipses, in pixels. The ellipse flattening is done while preserving the ellipse area, so this value is the geometrical mean of the two diameters of the average ellipse.

##### Size variability

The variability of the ellipse size, which is the spread of a log-normal distribution.

• When 0, all ellipses will have the same size.
• When 10, ellipses produced will usually range from one third to three times the average.
##### Average flattening

The average flattening of the ellipses, in percent.

• 0 is a perfect circle.
• 90 is a very flat ellipse
##### Flattening variability

The variability of the ellipse flattening, which is the spread of a gaussian distribution.

• When 0, all ellipses will have the same flattening.
• When 10, the flattening values between 0 and .9 are about equiprobable.
##### Average tilt

The average tilt of the ellipses from the horizontal, in degrees.

##### Tilt variability

The variability of the tilt, which is the spread of a gaussian distribution.

• When 0, all ellipses will have the same tilt.
• When 10, all tilt angles are about equiprobable.

#### Usage notes

The output of this script should be seen as a map that can receive further transformation

• Threshold to replace gradients by more "binary" values
• Curves, to change the shape of the gradients

There are many ways to use the output:

• Bump map
• Displacement map
• Color map
• Alpha channel

### density-brush-fill

Fills a new layer with random strokes of the current brush until the required density is reached.

#### Options:

##### Density

The percent of area covered, alpha-weighed

#### Usage notes

The output of this script is a new layer overlapping the current layer.

If the brush is an image pipe, the various images are used as designed

Autocrops all linked layers in the image. It appears in the menus as `Image/Autocrop linked layers` and has no parameters.

### clear-layers

Deletes the selection in several layers. `Edit/Clear layers/All` affects all layers, while `Edit/Clear layers/Visible` only affects visible layers. There are no parameters.

### replace-foreground-by-background

Repaint pixels in the currently set foreground color with the currently set background color using the proper color blends for the anti-aliasing pixels. It appears in the menus as `Colors/Replace foreground by background` and has no parameters.

### grid-filler-random-color

Fills spaces in a grid with random colors from a list or from the active gradient. The script iterates over successive points with the given X and Y steppings, does a fuzzy-selection starting at that point, and fills that area with a random color. The fill can occur on the same layer, or on a new layer which is inserted below the grid. The current layer when the script starts is assumed to be the one holding the grid.

The script is started by the ```Filters/Render/Fill grid with random color...``` `menu.`

#### Options:

##### Origin X & Origin Y

The starting point of the iteration (typically the center of the top left grid space).

##### Step X & Step Y

The stepping for the iterations, typically the same as the grid step, or a multiple of it.

##### Colors
The colors to use.
• In "list" mode, these colors are specified in HTML format (#rrggbb), with or without the leading hash, and separated by spaces, semi-colons, or new lines. The HTML notation for a color can be obtained from Gimp's color selector. The color can also be in the #rrggbbaa format where the "aa" part indicates opacity (from '00' (full transparency) to 'ff' (full opacity)).
• In "gradient" mode, the input is the number of colors to obtain from the current gradient by uniform sampling.

##### Selection threshold

The threshold used for the fuzzy selection.

##### Use new layer

If yes, the fill is applied to a new layer inserted below the grid layer. Otherwise, the fill is applied on the grid layer.

##### Grow selection

The amount to grow the selection before applying the fill. This is mostly useful in conjunction with the fill on a distinct layer.

#### Usage notes

• This script assumes a square pattern for the grid. Some grids (hexagons, circles) do not fit this model, but can usually be seen as a combination of two or three square patterns. They can then be filled by consecutive runs of the script, changing only the Origin X/Origin Y values.
• There are no iteration points outside the layer. This may lead to unfilled areas on the layer borders, if there are "open" areas. A specific run of the script with different Origin X/Origin Y values can be used to fill these.
• Best results are obtained with transparent grid areas, and fill applied in a new layer with a one or two pixels selection growth.
• If there is an active selection when the script is started, the fill will only be applied if the iteration point is within the selection, but the existing selection will not be combined with the fuzzy selection for performance reasons (the rationale being to restrict the fill to the areas that are within the selection to reduce execution time).  The original selection can be applied manually over the results.

### arrange-layers

Spaces or spreads layers across the selection.

• In "Spread mode", spreads the layers evenly across the selection boundaries.
• In "Space mode", arranges the layers with the specified spacing between their edges

Typical usage:

1. Mark the span boundaries with the rectangle selection (actually any selection will do, the script uses the bounding rectangle of the selection, and if there is no selection, it uses the canvas bounds)
2. Make the required layers visible
3. Pre-position the layers (they only need to be in the required left-right or top-down order, as indicated by their left or top boundaries)
4. Apply one the scripts versions (in ```Image/Arrange layers/Spread```)
##### Usage notes
• There are no options for this mode, but four different versions, so that each can be assigned to its own keyboard shortcut.
• Since the total spacing cannot always be divided exactly into the number of required spaces, some spaces (leftmost or topmost ones) may be one pixel wider than the others.
• The script only considers layer boundaries and not layer contents. You can have the boundaries match the content using "Autocrop layer".
• If the selection is smaller that the total size of the layers, the arranged layers will overlap, but the selection cannot be smaller than the larger layer in the considered dimension.

#### Space mode:

Typical usage:

1. Make the required layers visible
2. Pre-position the layers (they only need to be in the required left-right or top-down order, as indicated by their left or top boundaries)
3. Apply one the scripts versions (in ```Image/Arrange layers/Space```)
4. In horizontal (resp/ vertical) spacing, the leftmost (resp. topmost) layer is aligned with the left (resp. top) boundary of the selection. The selection doesn't need to encompass the layers.
##### Usage notes
• A negative spacing can be used to obtain overlap.

## settings-cleaner

This utility keeps the memorized settings of various tools under control. It is not really a plugin, even if it masquerades as such for its operation.

### Principles of operation

Gimp keeps the settings of the tool in a file in the `tool-options` subdirectory of the user's profile. This file is named `gimp-{tool}-tool.settings`. This file contains both explicitly saved settings (to which a name is given) and anonymous settings, that just receive a timestamp.

This utility keeps at most a specified count of the most recent anonymous settings, that are furthermore not older than some specified age. The "named" settings are not purged. The utility runs as part of the Gimp startup, and cannot be explicitly started from a Gimp menu.

### Installation and configuration

The Python file should be installed like any other python plugin (see sidebar)

#### Configuration file

The utility will not clean any file unless explicitly told to do so via the configuration file. The configuration should therefore contain one section for each settings file, named after the file, within brackets, like "`[gimp-curves-tool.settings]`". The section can define two values:

• `max_count`: the maximum number of anonymous settings to keep. A max_count of 0 will of course remove all anonymous settings.
• `max_age`: the maximum age in days of anonymous settings to keep. This number can be fractional (for instance, "0.5" will clean everything older than 12 hours)

A "`[DEFAULT]`" section can be used for values common to several sections

For example the following configuration file:

• Specifies the seven files to be cleaned
• Sets a maximum age of 7 days for all
• Sets a maximum count of 10 for most files, but this value is overriden with 5 for the gimp-threshold-tool.settings file.

```[DEFAULT]
max_age:7
max_count:10
[gimp-brightness-contrast-tool.settings]
[gimp-curves-tool.settings]
[gimp-levels-tool.settings]
[gimp-threshold-tool.settings]
max_count:5
[gimp-colorize-tool.settings]
[gimp-hue-saturation-tool.settings]
[gimp-color-balance-tool.settings]

```

The configuration file shoud be named after the Python file ("`settings-cleaner.ini`" if you do not rename the python file) and kept in the `tool-options` subdirectory of your profile.

#### Log file

Each run of the utility produces a log file ("`settings-cleaner.log`" if you do not rename the python file) in the `tool-options` subdirectory of your profile. If the plugin misbehaves, check that file, it could contain the explanation.

The log file is overwritten on each run, so it should remain small.

#### Usage notes

Some versions of Gimp (2.8.4 for Windows at least) do not keep complete timestamps (with hours, minutes, and seconds), so the fractional age may not work.