Share this topic on AskShare this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on TwitterShare this topic on YahooShare this topic on Google buzz

Author Topic: [Script-Fu] Animated Path Stroking/Path Suite  (Read 1534 times)

0 Members and 1 Guest are viewing this topic.

Offline fencepost

  • Member
  • **
  • Posts: 2,626
  • Karma: 0
[Script-Fu] Animated Path Stroking/Path Suite
« on: January 16, 2010, 08:49:34 AM »
This script will allow you to take paths and turn them into an animated hand-drawn look by choosing a couple of options.  Here's a couple of samples (although this only scratches the surface on what can be done.)  In addition to the main script, I've included several "supplemental" tools to help you with the process.  The script can be downloaded here: Fencepost's Path Suite.  Open the zip file and save the .scm file to your GIMP scripts folder (ie...C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts).  Refresh your scripts and you're ready to go.

I plan on preparing some usage tips and posting them, but I don't have time at the moment to do that.  However, I have prepared a couple of screenshots with some information to get you started.

This script was created as a gift to two individuals who have inspired me through their commitment to GIMP, their willingness to share knowledge, and dedication to artists all around the world.

First and foremost is ClayOgre.  Like me, ClayOgre, whom I haven't seen online in awhile, had a fascination with animations and paths.  When I first began scripting, he suggested that I try and figure out how to create scripts combining animations and paths.  I laughed!  No way it would ever happen.  Well, here we are today with my very first animated path script.  Thanks, CO, for your inspiration.

Secondly, and certainly not least, is to saulgoode.  Saulgoode is a silent giant in the GIMP community.  You never see much artwork produced by him, but the bestows on the GIMP community through his tutorials, scripts, understanding of programming and computers, and the inner-workings of GIMP is definitely "artwork!"  Without his sharing of knowledge, I would never have attempted scripting.

My hats off to both of you for your inspiration!  Thanks for all you do and I hope this script meets your satisfaction.

The scripts can be found at two locations (one for the animation and the other for the supplemental tools). 

The scripts are found by right-clicking on a path in the path dialog and choosing the desired script:

Some other useful scripts to use in conjunction with mine:


LIMN's (the split strokes script will let you separate all the strokes in a given path to individual paths)

Insanity Prevails

Open up a image (at this time it should be RGB/Grayscale) - haven't been able to figure out the painting for Indexed images yet.

Prepare a path(s) and you can begin.  Pick a brush tool (can be paintbrush, eraser, smudge, airbrush, pencil, or dodge/burn tool.  If you choose any other tool, it defaults to paintbrush), choose the desired brush, set the brush opacity, mode and run the script.  When you open the animation script, you will see this window:

Starting at the top:

Choose the stroke (a stroke is when a path has more than one piece to it.  For example, when you use fonts in many of the letters - a, e, p, q, etc. - have "holes" in them.  The holes are created by a separate piece (stroke).
Choose the number of frames you want the animation to paint
I've included several paint/path options (see image below)

The options are generally straightforward, but here's a general description...

"Paint paths and add segments"
- This will paint the layers and add every segment created to the image.  That way you can use them later if needed.
"Paint paths, but don't add segments" - Just paints the segments
"Don't paint paths, but add segments" - Pretty self-explanatory
Paint paths that have been previously segmented" - Select any path in the path list, tell it the number of frames to paint and it will do the rest.
"Paint by keyframes and add segments" - Let's say you want the animation to be at a specific location at a certain time, this option is for you!  Pick the start/end point numbers for the path and run the script.  If you don't know where the points are or what their ID number is, this is where the supplemental scripts come in handy.
"Paint by keyframes, but don't add segments" - Same as above without adding the segments.

Now, back to the main window options:

Add a copy of the final painted path segment to each layer above it in the layer stack.  If end your painting on a layer below the top of the stack, this option will copy it up to the top so that your animation doesn't abruptly cut off after that.  You can disable this feature.
The Start Point for keyframing.
The End Point for keyframing.
Color Method - Solid Color or Gradient
Choose the color/gradient to paint with
If you paint with a gradient, you need to specify a distance or it won't come out right.
Paint Method (only used with the paintbrush and eraser) - Constant or Incremental.  See the GIMP manual for a description

Some options can only be used in scripts through the script interface, some can't be used at all.  The ones required to be done through scripting have been included in the script.  The others (and there are only a few) can be changed in the appropriate brush dialog.

Fade out (paintbrush only) - the length of the brush stroke before fading.  This doesn't lend itself to the animation process at this time because it isn't set up to increment.  I may add that to the code later.
Airbrush/Smudge pressure or Dodge/Burn Exposure - This option sets the parameters for the tools listed.
Eraser hardness or Dodge/Burn - Another option that works depending on which tool you've selected.
Dodge/Burn Method - whether to paint on Shadows, Midtones, or Highlights

The brush spacing must be set here:

The brush opacity and paint mode could have been scripted, but I was running out of room on the script window.

Now, for a brief discussion of the supplemental tools.

Path Details - Gives you some basic information about the path/stroke (length, number of points, if the path is too long to be painted with the script - you may have to split up longer paths, etc.)
Path Direction - Paths are always stroked in the direction they are created.  But, what if you didn't create the paths manually?  You don't know the direction.  This script will paint the direction on a new layer for you.  The starting point will be green and it will transition to red.  The script will also tell you if the path is closed.
Reverse Path Direction - If you want a path to move in the opposite direction than it does, run this script.  A new path will be added with the points reversed.
Show Point - Need to know where a specific point is on a path?  This script will do it.  Very handy for keyframing.
Stroke Delete - Lets you delete a stroke in the path.  Just specify it's number.

Well, that's all for now.  I'll prepare more later.  Let me know if you have any questions or need more information.  If you find any errors in the script or would like to see it improved, suggestions are welcome.

Enjoy!  Cheers!

« Last Edit: February 12, 2010, 07:35:21 AM by fencepost »
I'd rate you as an upper-middle-lower-mod with pro-novice-inter tendencies.....and a twist of lime!  Of course, my rating scale is completely objectively subjective, but ALWAYS consistently inconsistent.

Offline HippieKender

  • Global Moderator
  • Posts: 1,106
  • Karma: 0
  • I seem to lick circular things...
    • hippiekender: PhotoBucket
    • @HippieKender:twitter
Re: [Script-Fu] Animated Path Stroking/Path Suite
« Reply #1 on: January 16, 2010, 08:56:29 AM »
Thanks so much for this, Fence! I'll have to give it a whirl ... after I have my morning coffee!

GimpDome dA Group || @GimpDome on Twitter
The most precious thing one can make is a friend.