It is currently Mon Jun 08, 2026 3:45 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 153 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 8  Next
Author Message
 Post subject: Re: Path Blend Script
PostPosted: Wed Apr 18, 2012 10:09 am  (#21) 
Offline
GimpChat Member
User avatar

Joined: Mar 23, 2012
Posts: 7388
Location: Göteborg at last!
lylejk wrote:
Might as well do something with the ring I made earlier. Erisian might like this one. ;)

Created a seamless interlinked texture and used Droste for the result. :)


I do!


Top
 Post subject: Re: Path Blend Script
PostPosted: Thu May 03, 2012 8:56 pm  (#22) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
Rob,

The maths is done. (And yours is good maths.)

Could you now give it the one minor tweak necessary to make it truly "glacial?"

Rather than a single static monolithic gradient to rule them all, would you consider computing a new gradient at each step to smoothly connect the value on the inner path to the value on the outer? Linear would be fine, but of course it would only take some more maths to make the gradient be any function of the two values. And then a sequence of gradients could be computed from the ordinal value of the pairs being connected... <oh just stop it>

I'll venture a guess that Alan would like this too. It gets to my attempt in an other earlier post which called for blending the edge of a zebra's head outward to white, or if Path Blend MkII appears, on to tiger stripes, or yum, shamelessly mixing metaphors, cheese.

I'm going to use it for bas relief. The outer path is in all-white territory, the top of the model. The inner path is at the outer edge of the sculpted part, where the depth/brightness varies.

Anyway, great work, as I have noted, in a fumbled way in another post hailing my discovery of a new script: Path Blend! :oops:

Oh, here's what I did. I Sampled-Gradient-Along-Path around the spiral-gradient filled circle in the vain hope that I might be "priming" a matrix with starting points for gradients, but of course I only created one gradient to be used to connect all pairs.
Image

Got a little Moyray thing goin on in there too.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Last edited by gramp on Sat May 05, 2012 7:48 am, edited 1 time in total.

Top
 Post subject: Re: Path Blend Script
PostPosted: Thu May 03, 2012 10:58 pm  (#23) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
gramp wrote:
Rather than a single static monolithic gradient to rule them all, would you consider computing a new gradient at each step to smoothly connect the value on the inner path to the value on the outer? Linear would be fine, but of course it would only take some more maths to make the gradient be any function of the two values. And then a sequence of gradients could be computed from the ordinal value of the pairs being connected... <oh just stop it>


I'm no Scheme programmer, but I was around when LISP (Lots of Inane Silly Parentheses) was invented, and looking at RMA_path_blend.scm, it looks like:

Line 89: (gimp-context-set-gradient inGrad)

would have to go inside the while at:

Line 98: (while (< strokecount (car strokes1))

and inGrad would have to be computed dynamically first by a function call inside that loop.

<thud>My head just hit the pavement. I think I broke it.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Fri May 04, 2012 2:47 pm  (#24) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
So something like this (xcf attached)?

Attachment:
pb2.jpg
pb2.jpg [ 10.94 KiB | Viewed 2209 times ]


It has a few artifact issues, and you need to make sure your paths are inside the coloured areas you want samples - see the xcf for how I did it. I also should have rotated the circle path a bit more to get it's start point lining up with the start point of the square.

The source file in the first link has been updated for you to test...It adds a "use sampled gradient" check box that will sample the image for each blend.

-Rob A>


Attachments:
pb2.xcf [426.63 KiB]
Downloaded 108 times

_________________
Image
Fantasy Cartography and Mapping by RobA
Top
 Post subject: Re: Path Blend Script
PostPosted: Fri May 04, 2012 7:57 pm  (#25) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
Yes, very close, but two of the corners suggest walls where I'd have a continuous curve.

I really thought I had it figured out. I could hardly wait to get home and try it.

Imagine a grayscale island scene floating in a transparent land-locked sea in a land of white.

Bleed the edges of the grayscale half the distance to the land.

Bleed the edges (or more simply, bucket fill the remaining half-distance with white.

Select the "band" defining the sea.

Gaussian blur half the width of the sea.

It should've worked, but I end with an artifact from the bleed which also shows up in the
subsequent gblur. But this is tantalizingly close. (The artifact appears to bevel the
otherwise-continuous image.)

ImageImage

Still have to try it on the square-to-round, but in my application both the island and the sea will
be similar shapes. [EDIT: sqr2rd showed same artifact, but otherwise the idea has merit.]

I shouldn't give the impression that this an artifact of the Bleed script, but rather an artifact of my coercion of the
Bleed script where I ought to be using a copy tool to "grow" the edge colors (like perhaps StepResizeKeepingLayers).

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Last edited by gramp on Fri May 04, 2012 8:34 pm, edited 1 time in total.

Top
 Post subject: Re: Path Blend Script
PostPosted: Fri May 04, 2012 8:10 pm  (#26) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
I see the steps now.

Select a 1px edge around the island.
Copy it to a new layer.
Scale the selection to be "slightly" (wtm) larger.
Merge the layer down to grow the island with (roughly) a copy of its edge.
Rinse and repeat until "halfway" (wtm) to land.
Fill the remaining sea with land color.
Gaussian blur the sea area.

Sorry, needed to get this thought out of my head before it's lost.

Now I'll go back and fetch your pb2.xcf

Thanky. (Great, now I'm channeling Granny from the Beverly
Hillbillies.)

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Fri May 04, 2012 10:34 pm  (#27) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
gramp wrote:
Scale the selection to be "slightly" (wtm) larger.



That is the issue. You can only scale it larger if it is a regular, convex shape.

-Rob A.

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Path Blend Script
PostPosted: Fri May 04, 2012 11:22 pm  (#28) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
OK - There was a dumb mistake again.... Don't sample visible from an image you are changing.... Now the code creates a new from visible layer internally and samples from that. Updated at the link to try...

The only artifact is now at the point where the path starts and ends.

Attachment:
blendsample.jpg
blendsample.jpg [ 9.36 KiB | Viewed 2186 times ]


-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 7:18 am  (#29) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
RobA wrote:
That is the issue. You can only scale it larger if it is a regular, convex shape.
-Rob A.


Well, at least that explains the deja vu'... :)

Observation: A 'kill' switch would be nice for the second-guessers among us who only
notice what they did wrong after they hit 'OK.' Thank gooness my CNC
has one: in fact, I built it around a Big Red kill switch. But I diverge.

Having started a Huge Test of PB, I noticed it was actually Pretty Stupid
too, but PB seems bent on finishing. Kind've like its master on Tootsie-Roll binge.
If my 'Cancel' button weren't greyed-out, I'd put it to effective use.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 8:39 am  (#30) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
RobA,

I say! By Jove, Watson, Eureka! You have met the enemy!
Image

[Sorry about the quotes. I been overcome. Tears falling on keyboard. <must... adjust... medications>]

+1 on the Pilot G2 pens [Sorry about the anti-climax.]

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 9:54 am  (#31) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
ahh finally thank to the last image you posted i got why you asked that

nice idea and cool effect

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 10:51 am  (#32) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
@PC,

It took me a long time to be able to express it. And you will note that many approaches give the same
appearance, but in the cases of myself and Alan, it's important that the gradient actually be continuous.

I am now rendering my piece of resistance. 1500x2200px. The band btwn paths is ~60px. I've selected
SampleGradient, but lowered the overlap to 0.5, which I guessed and appears to be faster than 2.0 (but
counting growth rings in the saplings I just planted outside will tell us for certainty.) 47min and counting.
And all 4 cores are bouncing around 40-80%.

@RobA As far as modern instrumentation admits, your script achieves glaciality.
AND BEYOND! What mechanisms there are for script-fu to apprise the user of status are
a mystery to me, but in the "(while (< strokecount (car strokes1))", is it possible to see an occasional
memo like "<strokecount> of <strokes1>"? Then I'd know there's time to mow the
yard. Or paint the house. :mrgreen:

Coincidentally that's kind've the effect I've been after too: smooth valleys between an image
and surrounding highlands, achieved over eons. :yes

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 11:41 am  (#33) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
I may have gushed a little too soon; needs some tweaking. It looks like the result might depend on how PathBlend decides where to start. I was going from outside->in, and it looks like the outer start point was a little CCW from the inner. But I don't ken paths. (For non-native English speakers--thank you, first of all, and second--'ken' is an old Scottish word for "know.")

Total run time was under 90 min. I dozed off.Image

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 1:46 pm  (#34) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
One other thing occurs to me: I was completely cavalier about verifying the paths had equal numbers of segments. (I just MADE 'EM UP!)

Is there a Path Properties item like Image Properties and what can be teased out about Layers in ScaleLayer?

The GIMP Library Reference Manual says, re: gimp_vectors_stroke_get_point_at_dist():
"For a closed stroke the start of the path is the first point on the path that was created. This might not be obvious."
Might? :roll:

My last experiment was to try running PB on two paths I've "opened" (by deleting a single nearby segment from each). It crashed the script, corresponding I think to where the opening was created compared to where I reckoned the start node to be.

However, the smaller path was made w/Selection to Path, and the larger from growing the selection by 60px and saving it as a path.

I just found that the Scale Tool advertises that it will scale paths, so I'm trying that now with the expectation that even if they should have differing numbers of segments at least their start points will be near each other.

EDIT: Nota bene. RobA later wrote the "Offset Path" script to create a new, offset path from an existing one, featuring the same number of nodes and edges parallel to the original. http://gimpscripts.com/2013/05/offset-path/

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Last edited by gramp on Tue Jul 22, 2014 3:10 pm, edited 1 time in total.

Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 2:20 pm  (#35) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
There is a way to 1) see what the script is doing and 2) optionally kill it. I made a video (you will want to watch in the highest quality you can..):

www.youtube.com Video from : www.youtube.com


In general, I'd suggest before working on a big image, scale a duplicate of the image down (this will scale all paths as well) and run it on the scaled down version, as it will work in the square root of the scaling time. (i.e. a 100 minute script on the full size image scaled down by a factor of 10 will run in 1 minute).

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 5:47 pm  (#36) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
Thank you, Rob.

I'm getting the idea from watching (my audio's blowed in any case) that I should be able to watch one of the temporary layers being constructed, giving me the view into the progress I requested, and that if I highlight and delete that layer, I can crash the script, and end PB's progress.

But hang it, I don't have a thing on my Toolbox that looks like that pull-down you have at 0:42s in the URH corner, listing Untitled-[12]. I finally found an Images tab I could add that showed an 'Untitled-<n>' window, which did in fact kill PB when deleted. However, it was not being updated as the script progressed.

EDIT: I take it Very Back: in fact the Layer I am running PB on IS being updated in the Layers menu. I have just never noticed it before! (It just happened to catch my eye, and one can easily see where PB started and how it's progressing.)

Perhaps now is the time to report my GIMP is 2.6.8 (which is still way modern).

What I'm getting with the small stuff looks promising. I noticed that low-overlap leaves transparency, so I hit the image again with a second go, and it definitely filled in more. I'll also probably blur as a later step too.
Image

One more feature might be to make the first line red, so one could see how PB is thinking. Or after the very first iteration, drop a permanent layer of the situation.

Might as well confess since you probably felt a disturbance in the force, that I attempted an edit of your script--just to make it come across with a wee bit of status information. "All I did was..." add:
(gimp-progress-set-text "Rendering Blend of Two Paths")

before the main (while ) and:
(gimp-progress-end)

after its end, lifted from another of your ubiquitous scripts.

I also had one of these in there:
(gimp-progress-update (/ strokecount strokes1))  ;update progress bar"


but the two I left in were enough to guarantee an early exit with no results. If I comment them out, we're off to the races, you should forgive the expression.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Last edited by gramp on Sat May 05, 2012 6:28 pm, edited 1 time in total.

Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 5:58 pm  (#37) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Yeah - it's pretty much useless to try and update the status text or percentage in a script-fu that calls other functions, as when something else is called (like a blend, or a pick colour) it overrides both the progress bar and text with whatever the plugin spits out....

I could have it spit out messages to the error console or error window, optionally...


-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Path Blend Script
PostPosted: Sat May 05, 2012 6:05 pm  (#38) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
Now suspect I needed to initialize; e.g., :ninja
(gimp-progress-init "Flooding out Colour" -1)

EDIT: I followed through on the other route of using (gimp-message ), and set the message-handler to CONSOLE, and then started GIMP from there.

After all that, I get this helpful output:
"Path Blend: Stroke #0 of 1"
:rofl

I wasn't even getting that until I appended a literal "%" into the (number->string ) func, aping what I'd seen in another .scm. Btw from what I can gather, GIMP's script-fu syntax is passed down from one developer to another in a purely oral tradition.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Sun May 06, 2012 6:21 pm  (#39) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
You can get better results by using the Path Editor to "tweak" the positions of the nodes on the two paths so they align better which will give better results in "edge" cases where you are tempting the definition of "convex."

In the case of a complicated outline, you can assure another path will have an identical number of segments if you duplicate the path and scale it (using Shift-T on it, and clicking on the Path icon in the "Transform" line of the Scale tool's options. Then use the Path Editor to re-arrange the nodes of the larger path into the outline you want.

"It would be nice if..." there was some way to see the nodes of BOTH paths while editing one.

"Does anyone know if..."
...it's possible to display both at the same time?

I've developed this trick to see both:
- export the inside and outside paths as CSV files [appar. these have to exist before-
hand]
- concatenate the two files into a single CSV
- edit it to change the path names to a single new name
- change the Stroke# ",1," for all the nodes in the second path to ",2,"
- import the new CSV into GIMP and double-click it to see the nodes (now both sets)
- rearrange nodes on both paths
- export the path as a CSV, and separate it into two again
- import those and you're ready to run Filters->Render->PathBlend

(If this is the only way to see both sets of nodes at the same time, "someone should
make a script"--someone who knows how, that is.)

EDIT: Btw, I edited the script and changed the output of the gimp-message handler
to ERROR-CONSOLE because I noticed in the Toolbox that it's possible to add a tab to
see the Error Console. :geek I also added some gimp-messages to (try to) dump some progress information: I added this:
(gimp-message (string-append "Segment#" (number->string counter "%") "of Stroke#" (number->string strokecount "%") "of TotalStrokes:" (number->string (car strokes1) "%")))

after this:
(while (< (+ counter 1 inLap) L1)

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
 Post subject: Re: Path Blend Script
PostPosted: Sun May 06, 2012 11:10 pm  (#40) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
Took the entire weekend, but I think I snagged it. (Thanks again Rob: made a dream come true.)

Image

The observant will note that in this particular example although I elected to use "Sample Gradient" (compute new gradients based on colors on the paths), as a practical matter the color values of the endpoints were constant.

I look forward with bated breath to someone submitting a run using the Sample Gradient (which uses the color values along the paths to compute new gradients along the path) which connects a path in an outside "color swirly" to one on a differently colored inside one.

Or one to connect an outer curve in the profile of, oh, Mickey Mouse to an inner one of, say, the Enchanted Castle.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Top
Post new topic Reply to topic  [ 153 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 8  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group