It is currently Thu Jun 04, 2026 1:31 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Is script that turns path to selection to layer possible?
PostPosted: Fri May 06, 2016 11:11 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
In my creation of height map greyscale images, I often do the same repetitive action over and over. Here's what I do.

I use the pen tool to select areas of the canvas (usually closed paths).
1. I turn the path to a [Selection] [From Path].
2. I create a new white layer.
3. And fill the selection with black [Fill with Foreground Color].
4. And then un-select [Select] [None].
5. Then I run the [Colors] [Threshold] on the layer (with the standard 127 and 255 setting).
6. And run [Layers] [Transparency] [Color to Alpha] on it.
7. Then click the button [Lock Alpha Channel] at the top of the layers dockable dialog.
8. Change the layer mode to [Darken Only]
9. And finally use [Colors] [Invert] on it to make the black white.

Can anybody make a script that can do all or maybe part of this procedure?

I make a bunch of these layers and then airbrush or just adjust the color using curves to blend each layer into each other. this is how I make height map images. The Airbrush creates nicely sculpted features. Or often times I just fill the areas with gradients. Each layer can then easily be adjusted with the curves dialog to set heights.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Fri May 06, 2016 11:41 pm  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
I think i can take this task

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Sat May 07, 2016 1:08 am  (#3) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
try this and let me know if it works like you wanted. I followed every single step.
Attachment:
path_to_selection_for_PegLeg44.scm [3.28 KiB]
Downloaded 247 times

It'll be available under Script-Fu/path-to-selection-for-PegLeg44
it'll select the active/selected path (just in case you have multiple paths defined/drawn)

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Sat May 07, 2016 6:39 am  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
PegLeg44 wrote:
In my creation of height map greyscale images, I often do the same repetitive action over and over. Here's what I do.

I use the pen tool to select areas of the canvas (usually closed paths).
1. I turn the path to a [Selection] [From Path].
2. I create a new white layer.
3. And fill the selection with black [Fill with Foreground Color].
4. And then un-select [Select] [None].
5. Then I run the [Colors] [Threshold] on the layer (with the standard 127 and 255 setting).
6. And run [Layers] [Transparency] [Color to Alpha] on it.
7. Then click the button [Lock Alpha Channel] at the top of the layers dockable dialog.
8. Change the layer mode to [Darken Only]
9. And finally use [Colors] [Invert] on it to make the black white.

Can anybody make a script that can do all or maybe part of this procedure?

I make a bunch of these layers and then airbrush or just adjust the color using curves to blend each layer into each other. this is how I make height map images. The Airbrush creates nicely sculpted features. Or often times I just fill the areas with gradients. Each layer can then easily be adjusted with the curves dialog to set heights.


Why don't you directly create a white shape on transparency? If you really need the scaled edges, use Levels, select the alpha channel, and set left and right handles to the same value.

_________________
Image


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Sat May 07, 2016 9:48 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
trandoductin wrote:
try this and let me know if it works like you wanted. I followed every single step.
Attachment:
path_to_selection_for_PegLeg44.scm

It'll be available under Script-Fu/path-to-selection-for-PegLeg44
it'll select the active/selected path (just in case you have multiple paths defined/drawn)


I can't express my gratitude for this trandoductin. This script works so fast. This script is going to save me so much time that it's ridiculous. How Can I ever thank you.

I make height map images that have anywhere from 20 to 100 different layers and this script could have saved me so much time if I had it earlier.

You are terrific, THANK YOU.

Image

Sincerely, Alan M.


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Sat May 07, 2016 11:25 am  (#6) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
cheers :hi5

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Sun May 08, 2016 10:49 am  (#7) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
If you have any other tasks that can be automated just let me know.

I enjoy doing them if it saves you time. (it's mostly cut and paste while following your steps so there isn't much thinking or creativity involved so it's grunt work but don't tell anyone, i think i enjoy grunt work :hehe )

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Sun May 08, 2016 7:05 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
I have an idea for a script that would take the various parts of the height map and separate them into thier own layers so that they can then be colorized but I will have to think about how the steps would go. So I'll probably look into it this week and post it here.

I don't know if it would be possible though. It might involve pasting the contents of the clipboard into a layer.

Alan


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Sun May 08, 2016 7:30 pm  (#9) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
it all (well almost all) can be automated.
the difficulty or impossibilities only come when you have to do something with your eyeing it. if it can be expressed in percentage or some absolute value or steps like menu selection stuff all can be automated.

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Mon May 09, 2016 2:49 am  (#10) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
PegLeg44 wrote:
I have an idea for a script that would take the various parts of the height map and separate them into thier own layers so that they can then be colorized but I will have to think about how the steps would go. So I'll probably look into it this week and post it here.

I don't know if it would be possible though. It might involve pasting the contents of the clipboard into a layer.

Alan

Not very hard, you duplicate the layers, add a layer mask (copy of the layer), and treshold it appropriately. This is how my luminosity-tiler script works.

_________________
Image


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Mon May 09, 2016 1:48 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
I made a video to show what I mean by colorizing a height map.

The script that I would want starts after the layer is placed on the top of the stacking order manually. And the script would start like this.

1. Set the layer mode to Grain Extract
2. Select the alpha of the layer [Layer] [Tranceparency] [Alpha to Selection].
3. Copy Visible [Edit] [Copy Visible]
4. Paste (Standard Paste should center automatically)
5. [Layer] [Anchor Layer]
6. [Colors] [Invert]
7. Threshold with the left field at 128 [Colors] [Threshold] (No need to change the layer to normal)
8. [Layer] [Transparency] [Color to Alpha]
9. Set layer mode to [Color]


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


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Mon May 09, 2016 3:19 pm  (#12) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
okay here it is. will be available under /Script-Fu/colorize-heightmap-for-PegLeg44
Attachment:
colorize_heightmap_for_PegLeg44.scm [2.82 KiB]
Downloaded 112 times


I added a 10th step for fun. it just renames the selected lay on top to apply script to whatever
the name was previously before appending " - colorize" at the end.
so for example if your layer's name was "horizontal copy" it'll now be renamed to "horizontal copy - colorize"

I thought it would be friendlier this way. If you don't want it i can remove it.

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Mon May 09, 2016 4:20 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
trandoductin wrote:
okay here it is. will be available under /Script-Fu/colorize-heightmap-for-PegLeg44
Attachment:
colorize_heightmap_for_PegLeg44.scm


I added a 10th step for fun. it just renames the selected lay on top to apply script to whatever
the name was previously before appending " - colorize" at the end.
so for example if your layer's name was "horizontal copy" it'll now be renamed to "horizontal copy - colorize"
I thought it would be friendlier this way. If you don't want it i can remove it.


A tenth step is fine. I don't hardly ever name layers anymore. I usually just click on a layer while I have the move tool selected to figure out what layer it is.

The script works good. This is not a script that I would use much but I thought this thing up a while back. And since you can make it so fast I thought I'd see if it is possible. It works. Thanks.

I have another script in mind that I will describe tomorrow. It is for making a rounded profile. Like making a bottle or baseball bat height map. I don't have time now but will tomorrow. It would need to use another script that I have. I don't know if that is possible.

Your photo looks a lot like my wife's brother. My wife is Taiwanese.

Alan


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Mon May 09, 2016 4:35 pm  (#14) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
yes it is possible just give me the script and describe what you want like how you've been doing in steps that's really simple to understand..

Maybe all asians do look the same :hehe I am Vietnamese.

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Tue May 10, 2016 9:18 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
trandoductin

can you make a script open the curves dialog box and choose a saved curve to use on the pixels on the layer?


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Tue May 10, 2016 11:33 am  (#16) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
I have looked and there doesn't seem to be away to load a saved curve's configuration.
maybe some expert can let me know if i am wrong.

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Tue May 10, 2016 1:37 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
How about changing the gradient to be used?

You see the script I'm thinking about would use a script that I have called Selection Blend by RobA

Attachment:
RMA_selection_blend.scm [4.9 KiB]
Downloaded 114 times


This script uses whatever gradient is selected at the time.

If this isn't possible then the script would have to be just the last part of the process, after selecting the correct gradient.


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Tue May 10, 2016 2:00 pm  (#18) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
I can write a script to call his script, yes.

Also I found some code in python fu that can apply curves from a curve file. While in colors/curves window you can click on the top right corner for an option to export the curve to a file into the gimp's curves folder.
Then whenever you run the script it can give you an option to select the curve file, you just have to browse to the curve file.
And I can call script to apply the curves settings from the curve file.
Of course you only have to do this browsing to a curve file once everytime GIMP starts, after that if you want to use the same curve file you just leave it as is as it's defaulted to the last selected value just like any other options in scripts.

Does that makes sense or would that work for you...
So instead of selecting a preset curve, we can import an exported curve file and apply a curve.

Let me know

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Tue May 10, 2016 2:10 pm  (#19) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
RMA_selection_blend.scm accepts gradient as input.

I could make a script to also accept gradient as input (that lets user choose gradient).

Or grab the currently active selected gradient from the context and input that into RMA_selection_blend call.
it's totally up to you.

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: Is script that turns path to selection to layer possible?
PostPosted: Tue May 10, 2016 8:39 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
I like the idea of user chosen gradient, but the script would actually need to select two gradients, for two separate layers. It would be one long set of things that it needs to do. And duplicating a layer and then using a different gradient will be one of them.

It could use one gradient but then would also need to alter the second one with the curves if you can't choose two.

I'm going to put the idea on screen tomorrow. I know what it needs to do but I just need to write it all out. You would have to look at it and see if it's possible.


Top
Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group