PDA

View Full Version : GIMP: How to Automate the Tedium?



Karro
03-04-2009, 10:19 PM
Okay, so here's one for you great GIMP overlords of cool:

Say I've got a transparent background tab with some blobs of color on it, and I want to take the smudge tool and randomly smudge these blobs of color inward (toward the center of the blobs) and outward, to give the color blobs a radial-like pattern that blends into the background layer.

Now, let's say I have a lot of these blobs of color, and it's going to take a long time to apply this "radial smudge" to all of them. How, oh great ones, would you automate this to make it easier on yourselves? (I tried using using alpha-to-select then stroke selection with the smudge tool selected, but this basically treated the smudge tool as if it was the painbrush tool, laying down whatever color I'd selected in whatever brush shape I'd selected instead of smudging anything.

Any thoughts would be duly appreciated, in the form of a nice soft wack from my +1 blackjack of repping... :)

RobA
03-04-2009, 10:36 PM
I have a python script (a modification of someone else's)that might do some of what you want...

Do you have python installed?

-Rob A>

torstan
03-04-2009, 10:48 PM
I'm sorry to suggest the obvious, but Gaussian blur doesn't do the trick? :) I guess that you are after something a little spikier?

Karro
03-04-2009, 11:22 PM
I have a python script (a modification of someone else's)that might do some of what you want...

Do you have python installed?

-Rob A>

I do indeed... and it appears to be working. (The posts I've been putting up on GURM and the problems I've had there seem to relate to the modifications that needed to be made to the .py and .ini files, but Python itself seems to work fine.)


I'm sorry to suggest the obvious, but Gaussian blur doesn't do the trick? :) I guess that you are after something a little spikier?

Nope, I'm afraid not. I'm looking to create a (slightly irregular) radial pattern - like an ugly starburst that fades out, only on highly irregular shapes.

jfrazierjr
03-04-2009, 11:28 PM
Okay, so here's one for you great GIMP overlords of cool:

Say I've got a transparent background tab with some blobs of color on it, and I want to take the smudge tool and randomly smudge these blobs of color inward (toward the center of the blobs) and outward, to give the color blobs a radial-like pattern that blends into the background layer.

Now, let's say I have a lot of these blobs of color, and it's going to take a long time to apply this "radial smudge" to all of them. How, oh great ones, would you automate this to make it easier on yourselves? (I tried using using alpha-to-select then stroke selection with the smudge tool selected, but this basically treated the smudge tool as if it was the painbrush tool, laying down whatever color I'd selected in whatever brush shape I'd selected instead of smudging anything.

Any thoughts would be duly appreciated, in the form of a nice soft wack from my +1 blackjack of repping... :)




How solid do you want the "spurs"???? Perhaps distort against a plasma layer (perhaps motion blurred in a specific direction). Alternatly, perhaps whirl and pinch might be what you need.

Perhaps an example would help.....

RobA
03-05-2009, 10:02 AM
With the script I munged up, if I start with this:
10911

and do a selection to alpha then alpha to path, running the script will do this:
10912

Enlarging and shrinking the selection first (to make an outside path and an inside path), then running the script first on the outside then on the inside I got something like this (after playing with spacing and such):
10913

Of course, randomness lengths could be added in. Unfortunately, pdb calls won't use new settings like jitter ;(

Let me know and I'll upload a copy if this is the effect you are looking for.

-Rob A>

jfrazierjr
03-05-2009, 10:10 AM
Let me know and I'll upload a copy if this is the effect you are looking for.

-Rob A>

umm... YEAH!!! thats kind of neat.. I would give you rep, but I just did that for the script you created for me the other day.



Of course, randomness lengths could be added in. Unfortunately, pdb calls won't use new settings like jitter ;(

If it does not take long to do, go ahead and add it in. Mo options is mo bettah.

bryguy
03-05-2009, 10:10 AM
Why not just use the iWarp tool?

jfrazierjr
03-05-2009, 10:13 AM
With the script I munged up, if I start with this:
10911

and do a selection to alpha then alpha to path, running the script will do this:
10912

Hmmmm.... with some playing with the right colors and some dodge/burn effects, this would make for a somewhat quick way to make top down(symbolic) mountains effect. With variable lengths, I expect you could make some niceish hills...

jfrazierjr
03-05-2009, 10:15 AM
Rob, I just had a thought, what if you use your top down mountain technique with the angular gradient fill, and then run this on top of the resulting height map?

torstan
03-05-2009, 10:29 AM
I'd be interested in getting my hands on this, for just the reason Joe mentioned.

RobA
03-05-2009, 11:00 AM
Rob, I just had a thought, what if you use your top down mountain technique with the angular gradient fill, and then run this on top of the resulting height map?

It does take a bit of futzing about.... Here is the result on the HF of the recent mountain tut I had posted.

The lines are a bit regular... adding some random to the code would probably help.

10914

-Rob A>

jfrazierjr
03-05-2009, 11:03 AM
It does take a bit of futzing about.... Here is the result on the HF of the recent mountain tut I had posted.

The lines are a bit regular... adding some random to the code would probably help.

10914

-Rob A>

That is THE BOMB DIGITY!!!! As you said, if you can get some randomness into the "smudge stroke"(perhaps a displace???), this would be pretty much perfect.

Karro
03-05-2009, 12:11 PM
With the script I munged up, if I start with this:
10911

and do a selection to alpha then alpha to path, running the script will do this:
10912

Enlarging and shrinking the selection first (to make an outside path and an inside path), then running the script first on the outside then on the inside I got something like this (after playing with spacing and such):
10913

Of course, randomness lengths could be added in. Unfortunately, pdb calls won't use new settings like jitter ;(

Let me know and I'll upload a copy if this is the effect you are looking for.

-Rob A>


That is pretty awesome close to what I was talking about! I wish I could pip you another green blob!

Karro
03-05-2009, 12:13 PM
Hmmmm.... with some playing with the right colors and some dodge/burn effects, this would make for a somewhat quick way to make top down(symbolic) mountains effect. With variable lengths, I expect you could make some niceish hills...

Joe: you have been reading my mind. That is exactly what I wanted this for.

I've been working (very, very slowly) on a worldmap with a lot of mountains... I was at this point and thought "why the crap should I do this by hand; at the rate I've been moving, it'll take me months to do all these..." So... I thought, what if it could be automated?

Karro
03-05-2009, 12:17 PM
It does take a bit of futzing about.... Here is the result on the HF of the recent mountain tut I had posted.

The lines are a bit regular... adding some random to the code would probably help.

10914

-Rob A>

Even if not, if I've got the outline of the mountains on a transparent layer, I can alpha to selection, then run a stroke selection or two with paintbrushes or erasers set to jitter or something to break up the lines and give it some randomnes, even if it turns out to be too difficult to add the randomness into the script itself.

RobA
03-05-2009, 04:09 PM
OK, I rewrote it as a script and added a bunch of parameters.

Start with the defaults. It shows up under the Edit menu...

It works against a path, not a selection, so you will have to convert a selection to a path.

The only "weirdness" about it is that path slope is not differentiated by direction. here is a sample run on a circle to show you what I mean....
10921

The top half stokes "inwards" first and the bottom half strokes "outward" first.

Depending on the pressure this might not matter, but it can be worked around by selecting inside the path (assuming it is closed) with a path to selection, running the script, then inverting the selection and running it again.

Have fun!

-Rob A>

Karro
03-05-2009, 04:31 PM
OK, I rewrote it as a script and added a bunch of parameters.

Start with the defaults. It shows up under the Edit menu...

It works against a path, not a selection, so you will have to convert a selection to a path.

The only "weirdness" about it is that path slope is not differentiated by direction. here is a sample run on a circle to show you what I mean....
10921

The top half stokes "inwards" first and the bottom half strokes "outward" first.

Depending on the pressure this might not matter, but it can be worked around by selecting inside the path (assuming it is closed) with a path to selection, running the script, then inverting the selection and running it again.

Have fun!

-Rob A>

Wow. This could be cool. And I think, artistically speaking, I could imagine other uses beyond the mapping I wish to do with it - if I was inclined to be artistic with my computer.

I already bumped you with my little rep-stick upthread. Wish I could give you more, but I'll have to spread some love first. Thanks a bunch, I think you saved me a month of work!

Steel General
03-05-2009, 06:45 PM
Great stuff as usual RobA!

RobA
03-06-2009, 12:38 PM
Never able to leave "well enough" alone...

I've updated the script so it converts the path to a selection and tries to figure out "inside". If there are unclosed path segments, the endpoints are joined and that is "inside". If the path segment is perfectly straight and the software uses "down" as "inside". The script won't check that your stroke length stays inside... you will have to worry about that yourself ;)

Here are the modes now offered (the faint red circles were added after to show the path location):
10966

And attached is the updated script.

..And if someone can provide the scheme code to turn a 4 value array: (cons-array 4 'double) where it holds X1 Y1 X2 Y2 into a larger array with jittered intermediate points, i.e. X1 Y1 Xa Ya Xb Yb ... Xz Yz X2 Y2 then the strokes could jitter...

-Rob A>

Karro
03-06-2009, 12:54 PM
RobA.

That.

Is.

AWESOME.

torstan
03-06-2009, 02:11 PM
There's a slight issue when you run the script that it doesn't return the selection to the layer you are working on. This means you have to remember to select the layer again if you want to run the script again.

Looks good so far! Thanks Rob.

RobA
03-06-2009, 03:00 PM
There's a slight issue when you run the script that it doesn't return the selection to the layer you are working on. This means you have to remember to select the layer again if you want to run the script again.

Looks good so far! Thanks Rob.

oops.

Throw in this line:

(gimp-image-set-active-layer img inLayer)

just before the line with the ;done down about line 249

That should take care of it.

-Rob A>

torstan
03-06-2009, 03:25 PM
I'll try that.

Thanks.

lisze
03-07-2009, 06:29 AM
That looks amazing. I like the effect that it has. I'll be trying this out.

RobA
03-07-2009, 01:33 PM
oops.

Throw in this line:

(gimp-image-set-active-layer img inLayer)

just before the line with the ;done down about line 249

That should take care of it.

-Rob A>

I updated the archive with this line. And have started a debate on the gimp-devel list. The issue is that saving a selection to a channel makes the new channel the active drawable! I thought this behaviour was confusing and said so. Looks like I convinced the gimp devels as they are planning to change the behaviour in a future release!

-Rob A>

Karro
03-09-2009, 12:10 PM
I updated the archive with this line. And have started a debate on the gimp-devel list. The issue is that saving a selection to a channel makes the new channel the active drawable! I thought this behaviour was confusing and said so. Looks like I convinced the gimp devels as they are planning to change the behaviour in a future release!

-Rob A>

Cool.

I tested this out late last week. I discovered another odd quirk, maybe related to this behavior you cited.

When you run the script, say you don't like the results and want to try different parameters... You "Undo" and attempt to run the script again, and you'll get an error. If I simply clicked on the layer I wanted back in the layer stack again, and ran the script again, it would work fine. So, I suspect it has to do with this confusing behavior.