Fwd: scriipt-fu or python?
This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Fwd: scriipt-fu or python? | John Culleton | 13 May 13:08 |
Fwd: scriipt-fu or python? | Rob Frohne | 13 May 17:06 |
Fwd: scriipt-fu or python? | Kevin Cozens | 13 May 21:13 |
Fwd: scriipt-fu or python? | John Culleton | 15 May 23:03 |
Fwd: scriipt-fu or python? | Kevin Cozens | 20 May 20:07 |
Fwd: scriipt-fu or python?
Gimp 2.6.11 on Slackware Linux:
1. Do python scripts go into the same folder as .scm scripts? If not, where? I find the .scm scripts in
/usr/share/gimp/2.0/scripts
2. I don't know either language but have programmed in COBOL and Tcl/Tk with side excursions into Perl, C and so on. Given this background which will the easiest to master for my first plug-in?
The task I have in mind is "gel" text as described in "The Artist's Guide to Gimp Effects" on page 268ff. I did same for my current project but did not have much fun going through the 26 +/- steps over and over.
Fwd: scriipt-fu or python?
Hi John,
I put python scripts in ~/.gimp-2.6/plug-ins/.
After trying script-fu and python, I recommend python. The language is more similar to what you know and better documented, and a more useful language to know anyway.
Best regards,
Rob
On 05/13/2011 06:08 AM, John Culleton wrote:
Gimp 2.6.11 on Slackware Linux:
1. Do python scripts go into the same folder as .scm scripts? If not, where? I find the .scm scripts in
/usr/share/gimp/2.0/scripts
2. I don't know either language but have programmed in COBOL and Tcl/Tk with side excursions into Perl, C and so on. Given this background which will the easiest to master for my first plug-in?
The task I have in mind is "gel" text as described in "The Artist's Guide to Gimp Effects" on page 268ff. I did same for my current project but did not have much fun going through the 26 +/- steps over and over.
Fwd: scriipt-fu or python?
John Culleton wrote:
1. Do python scripts go into the same folder as .scm scripts? If not, where? I find the .scm scripts in
Script-Fu scripts you want to add to your installation of GIMP should be placed in ~/.gimp-2.6/scripts. For all other add-on plug-ins/scripts you need to put them in ~/.gimp-2.6/plug-ins and they should be marked as executable. Script-Fu scripts do not need to be marked as executable.
NOTE: If you are using the development version of GIMP the directory is ~/.gimp-2.7
2. I don't know either language but have programmed in COBOL and Tcl/Tk with side excursions into Perl, C and so on. Given this background which will the easiest to master for my first plug-in?
The task I have in mind is "gel" text as described in "The Artist's Guide to Gimp Effects" on page 268ff.
You can certainly use either language to save yourself a lot of manual steps. If you want other people to use the script then Script-Fu will give you the widest possible audience for it as Script-Fu scripts can be used with every GIMP install. If you are creating a script for your own use, you can use either language.
If you are mainly used to writing programs in a procedural language you might want to use Script-Fu/Scheme. GIMP also comes with about 100 Script-Fu scripts that you can examine as you learn how to write your own Script-Fu script(s). If you go the Script-Fu route, I would also suggest you get a copy of the R5RS (or the two main parts of the R6RS) Scheme standard documents and you format the Scheme code like you would other programming languages. This means no putting all closing ) on one line. It makes it easier to see the syntax and structure of Scheme while you are learning.
On the other hand, if you want to create a script to save you some work with a language that would be more generally useful for other things outside of GIMP, you would be better off with Python. It is mainly an object oriented programming language but you can still use it for procedural programming. Python scripts for GIMP may make some use of OOP features and there may not be as many scripts with GIMP for you to look at.
You can always get help on the #gimp-user IRC channel or this mailing list whichever choice you make.
Fwd: scriipt-fu or python?
On Friday, May 13, 2011 05:13:47 pm Kevin Cozens wrote:
John Culleton wrote:
1. Do python scripts go into the same folder as .scm scripts? If not, where? I find the .scm scripts in
Script-Fu scripts you want to add to your installation of GIMP should be placed in ~/.gimp-2.6/scripts. For all other add-on plug-ins/scripts you need to put them in ~/.gimp-2.6/plug-ins and they should be marked as executable. Script-Fu scripts do not need to be marked as executable.
NOTE: If you are using the development version of GIMP the directory is ~/.gimp-2.7
2. I don't know either language but have programmed in COBOL and Tcl/Tk with side excursions into Perl, C and so on. Given this background which will the easiest to master for my first plug-in?
The task I have in mind is "gel" text as described in "The Artist's
Guide
to Gimp Effects" on page 268ff.
You can certainly use either language to save yourself a lot of manual steps. If you want other people to use the script then Script-Fu will
give
you the widest possible audience for it as Script-Fu scripts can be used with every GIMP install. If you are creating a script for your own use,
you
can use either language.
If you are mainly used to writing programs in a procedural language you might want to use Script-Fu/Scheme. GIMP also comes with about 100 Script-Fu scripts that you can examine as you learn how to write your own Script-Fu script(s). If you go the Script-Fu route, I would also suggest you get a copy of the R5RS (or the two main parts of the R6RS) Scheme standard documents and you format the Scheme code like you would other programming languages. This means no putting all closing ) on one line.
It
makes it easier to see the syntax and structure of Scheme while you are learning.
On the other hand, if you want to create a script to save you some work with a language that would be more generally useful for other things outside of GIMP, you would be better off with Python. It is mainly an object oriented programming language but you can still use it for procedural programming. Python scripts for GIMP may make some use of OOP features and there may not be as many scripts with GIMP for you to look at.
You can always get help on the #gimp-user IRC channel or this mailing
list
whichever choice you make.
_______________________________________________ Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
I have spent some hours analyzing the question further. We have plenty of examples of script-fu and plenty of tutorials for Python. We also have a whole fistful of plug-ins written in a compiler language. Is this C?
In my case the program itself is purely linear, 37 steps taken in a certain order. To this we can add at the front end a step or steps of collecting information from the user, via a screen with labels and input fields. But the whole process is straight line with no conditionals or branches. In this situation object oriantation woud seem to be irrelevant. It is all a straight line of step one followed by step two.
I have some early kindergarten level questions:
1. In the script-fu examples: functions or modules or whatever within Gimp itself are called by certain names and fed certain values. Do these identical names work in Python also? I see no centralized list of functions by name.
2. Does it really matter to Gimp in what language the script or plug-ins are written? For example could one write a plug-in using C or even Tcl-Tk so long as the right calls were made? Or must one use a special language- specific interface package?
In short before I go further I need ot know more about the gimp--plugin or script interface. I get that the plug in muist be registered with gimp. But is that registration process also just another call to a module written in C?
Fwd: scriipt-fu or python?
John Culleton wrote:
We also have a whole fistful of plug-ins written in a compiler language.
Most, if not all, of the compiled plug-ins for GIMP (that ship with it) are written in C.
1. In the script-fu examples: functions or modules or whatever within Gimp itself are called by certain names and fed certain values. Do these identical names work in Python also? I see no centralized list of functions by name.
The GIMP procedure names called by plug-ins can be found in the Procedure Browser located under the Help menu. You may need to make some adjustments to the procedure names and constants you see listed based on the language you will be using for your script. There are differences such as whether GIMP_ is used in constants and whether procedure names use - or _. You can determine the differences by looking at the Procedure Browser information and comparing it to example scripts.
2. Does it really matter to Gimp in what language the script or plug-ins are written?
You can use any language to create scripts for use with GIMP providing that you have a binding (ie. some routines written to provde the glue) to tie calls made in the language to the appropriate procedures in GIMP.
Language bindings exist for Perl, Python, Scheme, and Ruby.
But is that registration process also just another call to a module written in C?
Yes, the registration process is just a call to one or more procedures within GIMP. There is a register procecedure so your script can be accessed by other plug-ins or scripts and another register procedure that will make your procedure accessible from the menus. If your script needs inputs, the register block allows you to set up the information for the parameters you want people to be able to set before the script beings its real work. Again, you can look at the example scripts and plug-ins on how this is done.