It is currently Tue Oct 17, 2017 3:15 pm


Latest GIMP Scripts & Plug-ins

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: very simple script example needed
PostPosted: Sat May 21, 2016 5:19 am  (#1) 
Offline
GimpChat Member

Joined: Nov 14, 2013
Posts: 92
hello all, Trying for second time to move to Gimp from the other app :)
the biggest headache for me is lack of recordable actions.
There are some things I do that don't involve that many steps but is a hassle to do them over and over by hand.
I thought maybe I could write simple scripts to do those things but when I open a downloaded script to learn from it's too complicated, as it does a lot of steps.
What I need is a script example that only does a few simple things.
For instance one thing I try on images to improve them involves:
Select green channel
paste as layer
set layer mode to softlight, opacity abt 40%
---------
So any example scripts that just make a selection and paste as layer ?

_________________
using Gimp 2.9 with Linux on an ancient laptop


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: very simple script example needed
PostPosted: Sat May 21, 2016 5:43 am  (#2) 
Offline
Global Moderator
User avatar

Joined: Aug 10, 2012
Posts: 9253
Location: Formerly From NYC, Now in Arizona
Born2BeMild wrote:
hello all, Trying for second time to move to Gimp from the other app :)
the biggest headache for me is lack of recordable actions.
There are some things I do that don't involve that many steps but is a hassle to do them over and over by hand.
I thought maybe I could write simple scripts to do those things but when I open a downloaded script to learn from it's too complicated, as it does a lot of steps.
What I need is a script example that only does a few simple things.
For instance one thing I try on images to improve them involves:
Select green channel
paste as layer
set layer mode to softlight, opacity abt 40%
---------
So any example scripts that just make a selection and paste as layer ?

I understand your frustration.
What you're looking for is a custom script.
We do have a few really great script writers here on Gimp Chat.
Hopfuly one of them will notice your request and whip up a script for just this purpose.
One such prolific script writer is,
Gimp Chat member trandoductin.

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image
My YouTube Channel


Top
 Post subject: Re: very simple script example needed
PostPosted: Sat May 21, 2016 9:04 am  (#3) 
Offline
GimpChat Member

Joined: Nov 15, 2014
Posts: 400
I have also wished that the available scripts were fully commented - it would make the learning process much easier.
However, I think it would be unfair to expect the script writers to do that!

david.


Top
 Post subject: Re: very simple script example needed
PostPosted: Sat May 21, 2016 9:46 am  (#4) 
Offline
GimpChat Member

Joined: Nov 14, 2013
Posts: 92
david wrote:
I have also wished that the available scripts were fully commented - it would make the learning process much easier.
However, I think it would be unfair to expect the script writers to do that!

david.

Erm, yes I agree :)

_________________
using Gimp 2.9 with Linux on an ancient laptop


Top
 Post subject: Re: very simple script example needed
PostPosted: Sat May 21, 2016 1:02 pm  (#5) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 2858
Location: Tin from Victoria BC Canada
Inside Gimp,
Help->Procedure Browser
is your friend,
I don't remember any of the names of procedures to call in .scm files...
I just look them all the time every time i have to write a script.
You want to start with script that does nothing, or one that does something but just gut it out so it does nothing then search inside Help->Procedure Browser for procedures that you think they're called and try them out.
For your purpose i don't know if there's way to select channel I tried searching select-channel or channel-select and nothing showed up.
you might want to look at plug-in-decompose
then using the result grab which ever layer
It requires patience and playing around.
You can do it.

_________________
T.
Image gimplearn.net                                                                           


Top
 Post subject: Re: very simple script example needed
PostPosted: Sat May 21, 2016 5:59 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 3654
david wrote:
I have also wished that the available scripts were fully commented - it would make the learning process much easier.
However, I think it would be unfair to expect the script writers to do that!

david.


The appropriate level of comment in code is always debatable. My rule is to write comments that I'll find useful 6 months in the future, on a bad day, so this covers mostly the more tricky parts(*) and the unexpected things (aka the WTF factor). General code hygiene (clean structure, well-chosen names) removes the need for most comments.

Writing comments for a beginner would be mostly stating the obvious... and make the code hard to read by non-beginners.

(*) with limits:
Djiskra: "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague."

Kernighan: “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”

_________________
Image


Top
 Post subject: Re: very simple script example needed
PostPosted: Sat May 21, 2016 10:26 pm  (#7) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 2858
Location: Tin from Victoria BC Canada
here's an example script that does what you asked for ...
the commenting is kind'a repeatitive since the code says the same thing.
hope it helps
Attachment:
MyTest.scm [2.58 KiB]
Downloaded 54 times

_________________
T.
Image gimplearn.net                                                                           


Top
 Post subject: Re: very simple script example needed
PostPosted: Sun May 22, 2016 8:55 am  (#8) 
Offline
GimpChat Member

Joined: Nov 14, 2013
Posts: 92
@ trandoductin
wow thanks, does exactly what I wanted and is so well commented I can learn from it and change it to do other things with layers.
I notice that is was downloaded x9 before me so others are finding it useful too :)

I have a Question.
near the top of the script (line 9)you have
(green-channel 0)
I thought the red channel was 0 and the green 1 ?

_________________
using Gimp 2.9 with Linux on an ancient laptop


Top
 Post subject: Re: very simple script example needed
PostPosted: Sun May 22, 2016 2:50 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 3654
Born2BeMild wrote:
@ trandoductin
wow thanks, does exactly what I wanted and is so well commented I can learn from it and change it to do other things with layers.
I notice that is was downloaded x9 before me so others are finding it useful too :)

I have a Question.
near the top of the script (line 9)you have
(green-channel 0)
I thought the red channel was 0 and the green 1 ?

Best you know: there are two ways to do scripts in Gimp. One uses Scheme (.scm) and one uses Python (.py). Python is a lot easier to understand (it is the first computer language taught in many places...)(*), can do more things in Gimp, can be used for many things outside of Gimp, and won't cause a premature wear of your "(" and ")" keys.

Take the challenge: take any script here and see how much sense you can make out of it on the first read.

(*) pretty much everywhere it seems, except at the University of Paris where they teach... Scheme. But their excuse for this is "we want to make sure that no student ever used the language before, to put everyone on the same level". I swear I am not making this up. Ofnuts Jr. has already forgotten most of it, and he and his classmates considered this a wicked form of hazing.

_________________
Image


Top
 Post subject: Re: very simple script example needed
PostPosted: Sun May 22, 2016 8:37 pm  (#10) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 2858
Location: Tin from Victoria BC Canada
Born2BeMild wrote:
@ trandoductin
wow thanks, does exactly what I wanted and is so well commented I can learn from it and change it to do other things with layers.
I notice that is was downloaded x9 before me so others are finding it useful too :)

I have a Question.
near the top of the script (line 9)you have
(green-channel 0)
I thought the red channel was 0 and the green 1 ?

that (green-channel 0) is just the default value, you set it to a value later in the script and it's not 1 like you think it could be any id given by the procedure.
i named it "green-channel", you can name it anything like "channel" if you like.
you can either pre declare a variable and default it to something or you can (define) it as you go along. I have examples of both a pre declared green-channel variable...and set it later and later on in the script i also used (define) to define floating-selection.

_________________
T.
Image gimplearn.net                                                                           


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

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Add Guides In Range (.py script). Super simple script

2

No new posts Attachment(s) Need Help Testing A Simple Script

58

No new posts Attachment(s) Script-fu simple crystallize

9

No new posts Attachment(s) Need Assistance Testing Another Simple Script

90



* Login  



Powered by phpBB3 © phpBB Group