GIMP Script-fu

Artifact Content

Artifact b2904b8d179988c55e235ead0439af7a88f97d20:

Wiki page [sg-align-down] by saulgoode 2013-06-19 02:51:25.
D 2013-06-19T02:51:25.919
L sg-align-down
P 26ec8eda31fd1ed3dd075f4d2744336a9669e6e7
U saulgoode
W 2448
<dt><b>Command:</b> <dd>Align Down</dd></dt>
<dt><b>Menu:</b> <dd>"<Image>/Layer/Align Down"</dd></dt>
<dt><b>PDB Name:</b> <dd>script-fu-sg-align-down</dd></dt>
<dt><b>Download:</b> <dd>[|sg-align-down.scm] (after the page appears, click on the "Download" command)</dd></dt>
<dt><b>License:</b> <dd>[copyright|GPLv2+]</dd></dt>

<dt><b>Description:</b> <dd>
This script will reposition the active layer so that it is center-aligned with the visible layer beneath it in the layerstack. If there is an active selection then the active layer will be centered within the boundaries of the selection. If there is no visible layer beneath the active layer (in the current layer group) then the active layer will be centered relative to the current layer group.

While GIMP offers both the Align Tool and the Align Visible Layers plug-in, these are both a bit cumbersome to use for simple centering operations. This script, in conjunction with an appropriate selection or toggling of various layers' visibility, provides simplified support for a common use case.

Since all channels have the same boundaries as the image, running Align Down on a channel wouldn't normally have any effect. Rather than do nothing -- or worse, generate an error -- the script will treat the channel as a selection and center that selection on the image. For example, if you want to center a circular selection on the image, make your selection (on a layer) and then enable Quickmask mode and perform Align Down. When you exit Quickmask the selection will be centered.

The script is also useful for the situation where you have made a selection and performed an "Edit->Copy", followed by an "Edit->Paste As->New Layer". The new layer which results is anomalously always placed in the upper-left corner of the image -- not directly above the original location (as would happen with "Edit->Paste"). Running Align Down will reposition the new layer to be above its original location (assuming the original selection is still active).

Note: the name "Align Down" is derived from the fact that the rule for determining the "target" layer is the same as that for the "Merge Down" function (i.e., the first visible layer underneath the active one). Despite the name, there is no change in layerstack positions of any of the layers.</dd></dt>

Z 315753a8638b4087ba27991498238672