It is currently Mon Aug 24, 2026 3:17 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Is this Border Script Doable?
PostPosted: Sun Aug 21, 2016 4:13 pm  (#21) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
i guess we'll have to live with the workaround then..
Too bad.. I really hoped there was like a way to change to the tool to pencil automatically before the script runs so you don't have to like remember that extra step.

_________________
TinT


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Sun Aug 21, 2016 4:18 pm  (#22) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
Your script text as viewed in notepad doesn't say anything about using the pencil to draw the line for the resulting selection. I just wanted to let you know about that. I don't suppose it could be because I have set up my shortcut for the pencil tool to L.


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Sun Aug 21, 2016 4:23 pm  (#23) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
it doesn't it strokes path using the active brush. I don't think there is a solid line stroke path function, it just uses the active brush.
I just set brush to be hardbrush 100 and pixel width 1 and antialias OFF.

_________________
TinT


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Sun Aug 21, 2016 10:23 pm  (#24) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
I don't know how to draw a solid line using active brush, and there is no way to stroke a path with the pencil tool.
So i found a workaround using threshold 64, 255, it some times selects 2 pixel wide on some parts on lines when there is curve... but generally it's a thin selection still.
Give this a try.


Attachments:
start_with_a_pen_for_PegLeg44.scm [3.76 KiB]
Downloaded 66 times

_________________
TinT
Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 9:03 am  (#25) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
I get messages but the line seems to be only 1 pixel. I pasted the error box in the screen shot of the quick mask view.

Image

Is there a way to use the stroke path. Or maybe that's what your trying already?

Image


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 10:05 am  (#26) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
those are just messages, they're not errors so it's okay.
This version doesn't show messages.
Attachment:
start_with_a_pen_for_PegLeg44.scm [3.76 KiB]
Downloaded 170 times


There isn't a way to tell Gimp to switch tool to pencil because it runs script.
And there isn't away to call stroke path with solid line, all i can do is stroke using the active brush, and i don't know how to set the brush in such a way that it would behave like the pencil..I tried all sorts of context setting things. If you know a way how to get this single pixel line without using the GUI stroke line but with the stroke with paint tool and paint brush... I don't even see away to switch the tool...but it can only use active brush.

_________________
TinT


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 11:44 am  (#27) 
Offline
GimpChat Member
User avatar

Joined: Oct 06, 2010
Posts: 4050
I recall Ofnuts doing something similar (I think) using a path. Which would take you into Python territory.

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


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 11:47 am  (#28) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
well hopefully offnuts will chime in. :hehe

_________________
TinT


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 2:22 pm  (#29) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
I FOUND something, on the internet that allows to draw a path using .svg and then i load the mask as selection it actually selects a 1 pixel wide path that isn't cut off at certain sections when i tested.

here's the update.
You'll need an add an additional .py file into your plug-ins folder.
Attachment:
vector-to-line-stroke.zip [1.65 KiB]
Downloaded 157 times


Then update the .scm file with this.
Attachment:
start_with_a_pen_for_PegLeg44.scm [4.38 KiB]
Downloaded 114 times


I think it's pretty tight now. Test it and let me know how it goes. (Note: while it's working it'll save a temporary .svg file to your gimp's tmp folder and then delete it right afterwards).

_________________
TinT


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 3:27 pm  (#30) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
There is something i missed even though it worked as loading selection one pixel wide, but the drawing wasn't crispy, it had half transparent pixels around it.

There is an extra option in svg that i just added called shape-rendering="crispEdges".

This version actually draws a 1pixel wide fully opaque (you won't be able to tell the difference from previous version but it's there and more correct just so we have this in the future, we can do more with it less chances of it being buggy).

extract .py and put in/overwrite previous in plug-ins folder
Attachment:
vector-to-line-stroke.zip [1.71 KiB]
Downloaded 161 times


overwrite previous .scm file in scripts folder
Attachment:
start_with_a_pen_for_PegLeg44.scm [4.42 KiB]
Downloaded 182 times

_________________
TinT


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 6:02 pm  (#31) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
This one produces a selection that is off center when I try to use it over or next to the layer boundary edges. I'll just use the first one. I just hit the shortcut for pencil and then the shortcut for the script. It works great. Thanks!


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 6:59 pm  (#32) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
I think that might be solved with this one. We must solve it...We MUST :hehe I don't like that you have to remember to switch to a certain tool before running a script.

I solved by making the canvas size 5 times the original so that the path is always inside it.
Create a blank new layer and work on this new layer.
Once I have the selection.
Turn canvas size back to original, delete the new layer created and set active layer to the original layer.

to go along with the previous .py file.

Attachment:
start_with_a_pen_for_PegLeg44.scm [5.04 KiB]
Downloaded 115 times

_________________
TinT


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 7:51 pm  (#33) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
There's all kinds of work arounds I guess. This works fantastic. I've got a pretty fast computer so 5 times bigger is good. Could probably get away with 3 times bigger but you never know if I might need it that big one day.


Top
 Post subject: Re: Is this Border Script Doable?
PostPosted: Mon Aug 22, 2016 8:19 pm  (#34) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4527
Location: Canada
That's what i like to hear... :hi5

_________________
TinT


Top
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group