It is currently Sat Jul 11, 2026 9:58 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 1:28 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
sorry, Rod, not to offer my help, but whenever the word "path" comes into the game I fly away:
paths "non sono nelle mie corde" as we say in Italy...
(maybe you say "I'm not in my comfort zone with paths", if Google translates correctly the Italian motto)

_________________
"Where am I ?"


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 5:32 pm  (#12) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4497
Location: Canada
Check here for latest version -> Guides to Path (scheme script)
Here it is. Will be available under Image/Guides/Guide to path
Image

Create your guides however you like, run script and a path will be created at which point you can use to stroke however you like.

To stroke just a selection, just make your selection then stroke the created path and it'll only stroke where the selection is present..that is already built-in.

If you wanted to select from guides just uncheck snap to grid and check snap to guides under /View/ and it's easy to select (rectangle select) from guides.

_________________
TinT


Last edited by trandoductin on Sun Sep 18, 2016 8:38 pm, edited 2 times in total.

Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 6:06 pm  (#13) 
Offline
GimpChat Member

Joined: May 12, 2015
Posts: 4693
Wow, Tran! Did you write that script that fast?


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 6:07 pm  (#14) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4497
Location: Canada
well it's not very complex once you know which methods to call.

_________________
TinT


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 6:08 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
Great script! There is just one small nuisance for me:

I tried to enter intersecting path points on each row and column so that I could essentially cut the paths out where I didn't want them stroked, and it keeps cutting the whole path. Going to revisit the Path manual and see what I am doing wrong.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 6:11 pm  (#16) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4497
Location: Canada
i think it's much faster if you choose snap to guides and then rectangle select the area you want stroked and then stroke it using the whole path.

i could never remember how to insert a point to delete other parts of the path either... i always mess aroudn with it for like tens of minutes before figuring it out and then instantly forget again. :hehe

EDIT: This spawns another idea...which is if there is selection (defined by a bounding box).... only draw paths within this bounding box.
So that you can rectangle select the first row, then it'll only draw paths within this rectangle then you can move on to the second row by rectangle selecting it and redefine the guides and then run script to create path for the 2nd row and so on.

_________________
TinT


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 8:40 pm  (#17) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4497
Location: Canada
Just added release 2 which will only create path within bounding box of selection (if there is a selection).

as it's own thread.
Guides to Path (scheme script)

Please have a look. ;)

_________________
TinT


Top
 Post subject: Re: Python or Scheme script request
PostPosted: Mon Sep 19, 2016 1:04 am  (#18) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
Rod wrote:
PKHG wrote:
In principle you can do it, because as the guide-lab shows all guide info is easily available AND there is a method to create selections out of a list of points (x,y)


Then there is a way to get x,x (horizontal guide) OR x,y (vertical guide) coordinates from a SET of guides and from that create a selection that can be stroked?
Seems like you could use the brush to stroke between these coordinates then.


Sure ;)


Top
 Post subject: Re: Python or Scheme script request
PostPosted: Mon Sep 19, 2016 6:15 am  (#19) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
PKHG wrote:
Rod wrote:
PKHG wrote:
In principle you can do it, because as the guide-lab shows all guide info is easily available AND there is a method to create selections out of a list of points (x,y)


Then there is a way to get x,x (horizontal guide) OR x,y (vertical guide) coordinates from a SET of guides and from that create a selection that can be stroked?
Seems like you could use the brush to stroke between these coordinates then.


Sure ;)


Am on the way
Attachment:
arakne_extra_01.jpg
arakne_extra_01.jpg [ 196.43 KiB | Viewed 9426 times ]


There is a new button: Your whish! ..

And your real wish is not yet 100% explained!
That 'must' be mathematically precise! Example you could wish to select TRIANGLES ? :hehe
Look into Error Console after L322 there is the info hidden about what
guides I had in the picture ...


Top
 Post subject: Re: Python or Scheme script request
PostPosted: Mon Sep 19, 2016 6:32 am  (#20) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16099
PKHG wrote:

Am on the way
Attachment:
arakne_extra_01.jpg


There is a new button: Your whish! ..

And your real wish is not yet 100% explained!
That 'must' be mathematically precise! Example you could wish to select TRIANGLES ? :hehe
Look into Error Console after L322 there is the info hidden about what
guides I had in the picture ...

You lost me here, sorry. :(
So what does the "Your Wish. Let Us Go" button do?

_________________
Image


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Mon Sep 19, 2016 8:36 am  (#21) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
It does not do anything yet, because I need to know WHAT you exactly wish tod do!

E.g. two (or three??) horizontal guides two (or more) vertical guides and then select all rectangles inbetween(??? or ???) and select them and what next? stroke them black? or ???

So the wish is for a mathematician totally undecided ... exact wish is needed ;)

EDIT:
Because my way lets the guide-lab live one could say: select and stroke always the first upper middel rectangle ... deleting is easy so other rectangles could become the most upper left rectangle to stroke.
But maybe you would like to stroke (with what) all only the upper ones etc

Hope it is now clear what I want to know :yes


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Mon Sep 19, 2016 10:26 am  (#22) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16099
PKHG wrote:
It does not do anything yet, because I need to know WHAT you exactly wish tod do!

E.g. two (or three??) horizontal guides two (or more) vertical guides and then select all rectangles inbetween(??? or ???) and select them and what next? stroke them black? or ???

So the wish is for a mathematician totally undecided ... exact wish is needed ;)

EDIT:
Because my way lets the guide-lab live one could say: select and stroke always the first upper middel rectangle ... deleting is easy so other rectangles could become the most upper left rectangle to stroke.
But maybe you would like to stroke (with what) all only the upper ones etc

Hope it is now clear what I want to know :yes

I got ya! Actually I want to stroke all the guides at once. Tran wrote one in scheme (script-fu) already but a Python filter would be handy also.

_________________
Image


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Mon Sep 19, 2016 4:01 pm  (#23) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4497
Location: Canada
Now exists in python but a little more advanced.
It composes the path out of shorter line segments that meet at intersections so that you can easily edit/delete line sections from created path.

Now in Python (Guides to path).

_________________
TinT


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Mon Sep 19, 2016 6:16 pm  (#24) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
Tin, you are AWESOME!

LOL! Is anybody polishing up Tin's Golden Wilbur?

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Mon Sep 19, 2016 6:20 pm  (#25) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4497
Location: Canada
mahvin wrote:
Is anybody polishing up Tin's Golden Wilbur?

:hehe

_________________
TinT


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Tue Sep 20, 2016 7:11 pm  (#26) 
Offline
GimpChat Member
User avatar

Joined: Dec 26, 2014
Posts: 205
Rod wrote:
I wonder if you could actually write a script that creates a selection from user placed guides?

1) User creates a grid of guides. Then runs the filter.
2) The filter creates a selection from those guides and a path from that selection. The user could then stroke the path as they see fit. Or stroke the selection. Or perhaps the filter could allow a toggle for either choice?

An interesting idea, which I couldn’t get out of my mind wondering if it could be done. I got the selection from guides working then gave up on it, as I agree with ofnuts that it’s a roundabout way of doing things. I’ve uploaded the script here for anyone curious
Attachment:
oo-guides-to-selection-mk2.scm [2.53 KiB]
Downloaded 322 times

Located at <Image>/Script-Fu/Guides to selection

It is an unfinished script with no error checking and will crash or can give odd results if the user doesn’t

Add 4 guides, must be 2 vertical and 2 horizontal (the order of placement doesn’t matter)

Run the script

Repeat x number of times

Path to selection
Stroke path

PS You may need to Re-start gimp and have only one image open before using

Attachment:
guide2path2selection.jpg
guide2path2selection.jpg [ 667.98 KiB | Viewed 3544 times ]


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Wed Sep 21, 2016 9:34 am  (#27) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16099
I created this SVG Gradient for GIMP using my Notepad ++ editor. I named it (SVG Blinds)

Image

1) install the gradient attached into your gradient folder.
Attachment:
SVG Blinds.zip [393 Bytes]
Downloaded 179 times

2) Open a new image and refresh your gradients :refresh
3) In the gradients dialog, select SVG Blinds from the list.
4) In tool options select conical (sym) for shape and NONE for repeat.
5) Drag the gradient from center of image layer to an outer corner.

_________________
Image


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Wed Sep 21, 2016 9:58 am  (#28) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16099
Steve wrote:
Rod wrote:
I wonder if you could actually write a script that creates a selection from user placed guides?

1) User creates a grid of guides. Then runs the filter.
2) The filter creates a selection from those guides and a path from that selection. The user could then stroke the path as they see fit. Or stroke the selection. Or perhaps the filter could allow a toggle for either choice?

An interesting idea, which I couldn’t get out of my mind wondering if it could be done. I got the selection from guides working then gave up on it, as I agree with ofnuts that it’s a roundabout way of doing things. I’ve uploaded the script here for anyone curious
Attachment:
oo-guides-to-selection-mk2.scm

Located at <Image>/Script-Fu/Guides to selection

It is an unfinished script with no error checking and will crash or can give odd results if the user doesn’t

Add 4 guides, must be 2 vertical and 2 horizontal (the order of placement doesn’t matter)

Run the script

Repeat x number of times

Path to selection
Stroke path

PS You may need to Re-start gimp and have only one image open before using

Attachment:
guide2path2selection.jpg


Excellent script also! :bigthup Thanks.

_________________
Image


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sat Apr 26, 2025 5:09 am  (#29) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2606
Just pulled this out of my archive (for various purposes) and as well as working in Gimp 2.10 it also works without modification in Gimp 3.0

Slight difference from previous attachment, some changes by MrQ so attached again.


Attachments:
Guides-to-selection-mk2.scm [2.88 KiB]
Downloaded 45 times
Top
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group