It is currently Sat Apr 20, 2024 11:29 am


All times are UTC - 5 hours [ DST ]



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

Joined: May 16, 2010
Posts: 14709
Location: USA
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?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Last edited by Rod on Sun Sep 18, 2016 6:39 am, edited 1 time in total.

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: Python or Scheme script request
PostPosted: Sun Sep 18, 2016 5:56 am  (#2) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
Have a look here:
http://www.arakne.es/en/dessign/gimp-guideslab-edit-guides-numerically/
There you can set and change guides ... very very nice!

What you then want after having a lot of (more then 4) guides is not clear to me.
Explain, maybe with a picture?


Top
 Post subject: Re: Python or Scheme script request
PostPosted: Sun Sep 18, 2016 6:37 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
PKHG wrote:
Have a look here:
http://www.arakne.es/en/dessign/gimp-guideslab-edit-guides-numerically/
There you can set and change guides ... very very nice!

What you then want after having a lot of (more then 4) guides is not clear to me.
Explain, maybe with a picture?

I do have Guide Labs and it is a great filter to add extra guides. But it doesn't create a selection from those guides.
Actually i am trying to automate somewhat a grid for a printable document say for an office table grid.
see - viewtopic.php?f=8&t=14563

The user would possibly use "Guide Labs" to create the guides and the filter would create a selection from those guides. OR maybe the "Guide Labs" PDB functions could be called as part of the new filter dialog?

Then you could do it all from one filter.
1) Create your doc you want any size (possibly the filter could do this also)
2) run the filter which gives the user a way to add guides
3) and then creates a selection from those guides
4) allowing the user to stroke the selection as they see fit.

I am basically asking is there a way to select from guides?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 8:44 am  (#4) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
Good idea Rod, I've thought about something along those lines as well. The Guillotine command slices guides into separate images and all guides can be removed at once so you would think there is a way to select guides?

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 8:58 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Odinbc wrote:
Good idea Rod, I've thought about something along those lines as well. The Guillotine command slices guides into separate images and all guides can be removed at once so you would think there is a way to select guides?

Yes and Filters>Web>Slice will slice images into pieces using guides also. So there must be a way to select guides.

Maybe only in C as an executable?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 9:19 am  (#6) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
Rod wrote:
Odinbc wrote:
Good idea Rod, I've thought about something along those lines as well. The Guillotine command slices guides into separate images and all guides can be removed at once so you would think there is a way to select guides?

Yes and Filters>Web>Slice will slice images into pieces using guides also. So there must be a way to select guides.

Maybe only in C as an executable?
Wouldn't most of that be in PDB?
I found a few of interest.
gimp-image-get-guide-orientation
gimp-image-get-guide-position
gimp-image-find-next-guide

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Python or Scheme script request (selection from guides)
PostPosted: Sun Sep 18, 2016 10:01 am  (#7) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
I honestly think that in some cases, because of rows or columns having different cell containers, it might be more beneficial to utilize (rectangular) paths. Not to say that a guide selection script doesn't have its advantages, just that tables are a different beast for guidelines (unless everything is symmetrical). Two rows with different dimensioned cell sizes would pose a problem for selecting as a table. Just a thought.

_________________
"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 10:34 am  (#8) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4736
mahvin wrote:
I honestly think that in some cases, because of rows or columns having different cell containers, it might be more beneficial to utilize (rectangular) paths. Not to say that a guide selection script doesn't have its advantages, just that tables are a different beast for guidelines (unless everything is symmetrical). Two rows with different dimensioned cell sizes would pose a problem for selecting as a table. Just a thought.

Yes.

Furthermore I don't see the point in going into the trouble of positioning 4 guides (4 things to drag around) to create a rectangle selection when the same can be done with one drag using rectangle select directly. And if you need guides and selection, you can get the guides from the selection (Image>Guides>New guides from selection).

_________________
Image


Top
 Post subject: Re: Python or Scheme script request
PostPosted: Sun Sep 18, 2016 10:48 am  (#9) 
Offline
GimpChat Member

Joined: Sep 13, 2016
Posts: 137
Rod wrote:
PKHG wrote:
Have a look here:
http://www.arakne.es/en/dessign/gimp-guideslab-edit-guides-numerically/
There you can set and change guides ... very very nice!

What you then want after having a lot of (more then 4) guides is not clear to me.
Explain, maybe with a picture?

I do have Guide Labs and it is a great filter to add extra guides. But it doesn't create a selection from those guides.
Actually i am trying to automate somewhat a grid for a printable document say for an office table grid.
see - viewtopic.php?f=8&t=14563

The user would possibly use "Guide Labs" to create the guides and the filter would create a selection from those guides. OR maybe the "Guide Labs" PDB functions could be called as part of the new filter dialog?

Then you could do it all from one filter.
1) Create your doc you want any size (possibly the filter could do this also)
2) run the filter which gives the user a way to add guides
3) and then creates a selection from those guides
4) allowing the user to stroke the selection as they see fit.

I am basically asking is there a way to select from guides?


Grrr I answered some hours ago and saving did not work? OK Again:

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) ...
All intersections of guides are so to say known and could be used either one for one or all at once to create out of the guides selections (all rectangular or polygons of other type!) .

Maybe it is a good idea to extend the guide-lab a bit, to suit your wishes (which are not yet 100% clear to me).
Why? Because the guide-lab window is a GTK-window and independent in some sence from the Gimp-window. Means use and or change/add guides with guide-lab select in the Gimp-window some part of your wish and let the extended plugin do what you want; the guide-lab still active ...

So some more explanation needed , the pictures and the xcf of the link (above) make it a bit clear but yet not 100% ... Try ;) a bit more ...


Top
 Post subject: Re: Python or Scheme script request
PostPosted: Sun Sep 18, 2016 12:45 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
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.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 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: 14816
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: 3975
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: 4694
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: 3975
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
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
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: 3975
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: 3975
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 2475 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
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
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
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


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

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Guides from selection

2

No new posts Attachment(s) Falling snow animated Scheme Script for Gimp

121

No new posts Attachment(s) Script request

3

No new posts Attachment(s) Is there a script for doing Stroke outside selection?

4

No new posts .py script not showing under Python-Fu

3



* Login  



Powered by phpBB3 © phpBB Group