GIMP Script-fu

Artifact Content

Artifact 91165635ba40ddd66a5f6541f08557f673ae76d5:

Wiki page [sg-warp-text] by saulgoode 2013-11-25 13:07:50.
D 2013-11-25T13:07:50.286
L sg-warp-text
P af107b05fac7f3939bda2831b9fd5a1e1a0363f3
U saulgoode
W 2715
<dt><b>Command:</b> <dd>Warp Text</dd></dt>
<dt><b>Menu:</b> <dd>"<Image>/Filters/Distorts/Warp Text..."</dd></dt>
<dt><b>PDB Name:</b> <dd>script-fu-sg-warp-text</dd></dt>
<dt><b>Download:</b> <dd>[|sg-warptext.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 was inspired by an Inkscape extension written by Gerrit Karius. 

This script will warp text to fit inside a four-point [|bezigon] (also known as a beziergon). The bezigon is created with the Path Tool by first placing an anchor where the upper-left corner of the text should go, followed by three more anchors running clockwise around the perimeter. 

Once your shape path is created, you can run the script on any text layer and eventually, after a good deal of huffing and puffing by the script, a new path will be created which is the outline of the text warped to fit within the path. Basically, you are left just as you would be after doing a "Text along Path" in the Text tool Options dialog -- you are left to your own devices as to stroking the path, selecting from it and filling, etc.

<center><img src="" alt="Broken Link"></center>

One caveat is that the path coming out of an anchor should proceed "towards" the adjacent anchor. In other words, the angle of a line from the anchor to its control handle and a line between the anchor and the next anchor must not exceed 90 degrees. The script will still function if this advice isn't heeded, but the results may be unpleasant.

<center><img src="" alt="Broken Link"></center>

The script's dialog offers the option to warp any path, not just text. And also permits specifying a Padding value and a Quality setting. The "Quality" setting can range from "1" (where letters are barely recognizable) to "250"; I don't notice much improvement above "100" and I set the default to "60" as a speed versus quality compromise (higher quality settings may be necessary for larger images).

The results achieved are not perfect, and the script is rather slow; but it can be useful for certain applications. Some discussion about the script and examples of it in use can be found at <a href="">GIMPchat forums</a> (special thanks to the members of that forum who helped me debug the script).

Z 804016bf740c6f0a3053f830087e5d30