GIMP Script-fu

Artifact Content
Login

Artifact 0be8568b592c47b97a14e2ff1630a453b26f9af0:

Wiki page [sg-fit-face] by saulgoode 2013-08-29 03:53:16.
D 2013-08-29T03:53:16.767
L sg-fit-face
P bd2d20be12eb71ca2b5340f756b043e73d3c74fc
U saulgoode
W 2609
<dl>
<dt><b>Command:</b> <dd>Fit Face to Path</dd></dt>
<dt><b>Menu:</b> <dd>"<Image>/Layer/Fit Face to Path"</dd></dt>
<dt><b>PDB Name:</b> <dd>script-fu-sg-fit-face</dd></dt>
<dt><b>Download:</b> <dd>[https://chiselapp.com/user/saulgoode/repository/script-fu/artifact/f510b2955430dec7dbced70529cf56d3f505fef2|sg-fit-face.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 adds a command to the Layer Menu which will scale and rotate the current layer such that it is oriented and sized to fit over the region determined by the entered path points.

The script is generally intended for superimposing one person's face on another's body; though it is not limited to "faces". It may also be useful for creating collages or for cartography overlays (as discussed in [http://forum.meetthegimp.org/index.php/topic,1197.msg10089.html#msg10089|this thread on the Meet The GIMP forums]).

To use the script, you would typically have both graphics (the substitute face and the original model) as separate layers in the same image. You would then use the Path Tool to mark the start and end points of a path that spans between two notable features on the "face" layer (the top of the face and the bottom of the face being the most obvious choice, but the script also works with paths for ear-to-ear or eye-to-eye, etc). You then would hide the face layer (if necessary) then hold down the SHIFT key and click on the position of the first notable feature on the "model" layer, release the SHIFT and click on the second feature as it appears on the "model" layer. With the "face" layer active, you would then run the script ("Layer->Fit Face to Path").

For those unfamiliar with the Path Tool, what you are doing is creating a single path comprising two separate "strokes" (disconnected segments). The first stroke is a two-point line from one feature to the next as they are located on the "face" (or source) layer, and the second stroke is a two-point line that specifies the correlating points on the "model" layer. When drawing a path, newly created anchors are added to the same stroke unless you hold down the SHIFT key as you create a new anchor, in which case a new stroke is started. The new stroke is NOT a new path, it is a separate segment which will be part of the same path.

Here is an animated GIF which attempts to demonstrate the process:

<center><img src="http://barn.kerosenecow.net/mgoblin_media/media_entries/74/lyle-gored.gif" />
</center>
</dd></dt>
</dl>

Z 4ec98b0de5044c6bb6f6434a3173b641