Preferred programming language for GIMP plug-ins and scripts
#1
Posted 09 February 2007 - 11:02 AM
In 2004 I started my GIMP# project to support plug-ins written in C#. More recently we also support Java and Python on top of the .NET platform. It's pretty straightforward to build Visual Basic.NET, BOO (http://boo.codehaus.org) and Nemerle (http://nemerle.org) on top of GIMP# and we have plans to introduce this into one of the next GIMP# releases.
Please share your experiences with or opinions on any of these languages for programming GIMP plug-ins.
#2
Posted 09 February 2007 - 02:59 PM
My vote was for Script-fu though I would admit it has some limitations that are not part of other scripting languages. Script-fu is unable to generate Previews of the operation, nor is it able to interactively interface with the user (other than the initial dialog box). Despite these limitations (and there is hope they will be removed before Version 3.0 of the GIMP), Script-fu has a lot going for it. It is a simple language that is easily implemented and only uses about 1 to 1.5 megabytes of memory (depending on the number of scripts, the core language itself is only 60Kbytes). The console is both a good debugging tool but also just plain fun to experiment and learn about how the available functions work.
#3
Posted 09 February 2007 - 03:11 PM
Quote
I completely overlooked Lua. Thanks for adding it to the poll.
And I agree with you, Script-fu is a fun language to use. Scheme has always been high on my list of preferred languages.
#4
Posted 25 November 2007 - 04:04 PM
#5
Posted 26 November 2007 - 12:00 AM
1 i understand the difference between script and plugin (at least in gimp)
2 the difference is tied to the programming language used or to other reason
For what i understand Script (at least Script fu, ) may only automatize,speed up some effect already available
Some script may apparently create some new effects, but that because some combination are not obvious,and some features are not so easy accessible from the GUI...but usually having time and will same result will be , at least in theory, available without the script
Plugin instead may allow results that will be no possible obtain just by a combination of features already available...
IS this correct?and if so limitation about "script" are only for script -fu or also for python perl and so on?
And are a limitation of the languages or just of its implementation in Gimp ?
---------------------------------------------------------------------------------------------------------------------------
suppose as example that a macro-recorder for gimp pop out now
then will be not much need anymore to create script to automatize repetitive tasks....why code something that may be simply recorded on the fly?( sure ...still will be very useful to be able to edit the recorded actions..but i believe you get my point)
but instead will be always interest to add new features or effects
Oh well, seems a basic thing to understand before chose a preferred language, and still i'm not sure if i get it
#6
Posted 26 November 2007 - 02:00 AM
GIMP is a restaurant where the chef speaks only English and the customers are the scripts and plugins. A plug-in is like an English-speaking customer, he can talk directly to the chef and tell him exactly what he wants.
Scripts are like customers who do not speak English. They need to tell an interpreter what they want and the interpreter translates the order into English.
Script-fu is like a waitress who speaks Italian, for example. An Italian customer can go to the restaurant and the waitress will always be there to translate the order into English for the chef.
A customer who speaks German, for example, would be like a Python script. If he wishes to order at the restaurant, he needs a different interpreter. If the German places an order, the chef looks to see if there is a German interpreter available (that is, whether Python is installed). If there is then the chef tells the interpreter to find out what the customer wants.
French (Perl), Spanish (Gluas), Japanese (Ruby), and other "customers" can only order from the restaurant if an interpreter is provided.
An English-speaking customer (a plugin) is going to have an easy time telling the chef what to do. He can be very precise about what he wants and how he wants it prepared. He can even watch the chef closely and tell the chef when to stop adding salt.
An Italian customer (Script-fu) is limited by how well the waitress speaks Italian. If the waitress doesn't know the English word for "prosciutto" then the customer will not be able to order "ham" -- however, our waitress is always there and she does know quite a bit.
The other customers are also limited by how well their interpreters speak English, but usually those interpreters are pretty good. It is still slower to order your food than if the customer were English (scripts are slower than plugins) and this slowness makes things like controlling how much salt to add difficult, but the interpreters generally speak better English than the waitress.
GIMP# is kind of a strange hybrid of a script, it is like having an Esperanto waitress who speaks many other languages as well. She is expensive to hire (uses lots of memory), but is very fast and very effective.
#7
Posted 26 November 2007 - 04:03 AM
i will stress a bit to see if i fully understand
Once i was in Manila...on 3 sides of the square expensive Hotels, on the other side was a Favela,but the very first barrack was a sort of Restaurant for rickshaw drivers, tourist guides , ambulants,
(real Favela started at the back side of the Restaurant )
was my favorite restaurant from Monday to Saturday
--------------------------------------------
But the point was Sunday Sunday was supposed to be closed and so become the best day for me and the Chief...
Chief get the Restaurant , the Kitchen ,good fresh fishes, vegetables and fruits
i added Tourists ,spaghetti, "parmigiano" cheese , and related " how to"
he was taking care of fishes and service on the tables, i just have to give instruction for spaghetti and organize the fund raising
well...i was a plugin right? Without a connected restaurant i could do nothing , but as restaurant plug-in i could add spaghetti to the menu
while that German translating for the Germans was a script...he could arrange extra portion , obtain less hot chilly and more beers, but no add Sausages and Sauerkrauts to the menu...correct?
------------------------------------------------------------------------------
i could not resist to this anecdote but your explanation was really clear, thank you :h:
#8
Posted 26 November 2007 - 06:43 AM
#9
Posted 26 November 2007 - 07:40 AM
@PhotoComix: the difference between scripts and plug-ins in GIMP is somewhat artificial. In theory you should be able to implement the same functionality with both a script and a plug-in. However since scripts are usually interpreted (as opposed to plug-ins that are compiled), a plug-in will be a lot faster. That's why you use scripts to call existing functionality. You don't do the actual calculations yourself, but just combine fast existing routines. If you want to do pixel manipulation (for example the grayscale conversion that ulillillia describes) you want a plug-in, not a script.
GIMP# is somewhat different: it exposes several languages (C#, Java, Python and Nemerle) to the plug-in programmer. The languages are all compiled to the same CLS (Command Language Specification). The nice thing about this is that I only have to write a GIMP binding once and can use it in any .NET language. The downside: it is somewhat slower than native C (about 2 times as slow) and it consumes more memory. This situation will improve as Mono (or .NET) compilers evolve. What you get in return is an environment in which you can create a plug-in with less than half the lines it would take to program something similar in C.
#10
Posted 26 November 2007 - 12:37 PM
Quote
Perfect this is answer to any question left
On a side note...why is so complex provide a Windows installer for Gimp# ?
I mean you have already a list of the dependencies needed ...or something has still to be ported/adapted from Mono to NET ....or ...?
#11
Posted 26 November 2007 - 01:34 PM
Quote
I mean you have already a list of the dependencies needed ...or something has still to be ported/adapted from Mono to NET ....or ...?
There are four issues: 1) I don't have a Windows machine, neither at work nor at home 2) I'm not familiar with creating Windows installers. Until now this has been handled by a GIMP# co-developer. 3) There seem to be some subtle differences between Linux and Windows: sometimes GIMP# plug-ins crash on win32 while the same plug-in is very stable on Linux. 4) Some plug-ins depend on a small piece of wrapper code written in C. This is not always portable.
All the problems mentioned can be solved, but without a win32 box or a volunteer to create the installer, it will be pretty difficult for me.
I did get GIMP# working on my MacBook, so I'll do a release for OS-X pretty soon. I know, that's not of much comfort to all the win32 users out there.
#12
Posted 27 November 2007 - 12:36 PM
Quote
well i didn't ask why you didn't do yet but just i wanted to know if , when i finish to set up my new computer, is something i may try to do
but i fear not , also for the other 2 points
Quote
sure somebody else may solve, ...about me i will need a lot of good luck even to compile something with a complete list of dependencies.
..no hope i may hack " not always portable small piece of wrapper code written in C"
#13
Posted 28 November 2007 - 12:05 PM
#14
Posted 30 November 2007 - 09:46 AM
#15
Posted 30 November 2007 - 04:59 PM
http://www.gimptalk....08-26497-1.html
The connection is that VS has to do with programming language if i'm not wrong and now there is a GIMPVS...but ...well ...what may be the practical use (for coders or/and end users ) of a VS version of Gimp ?
And a similar solution may have some advantage versus, as example on adding VS support to GIMP# ?
(not sure if this make sense...or if is already done ..well i admit my ignorance ...but if i knew, then i would have no reason to ask)
#16
Posted 30 November 2007 - 06:50 PM
Quote
I see two advantages: the first one is that the Microsoft C compiler might do a better job than the usual compiler that is used for GIMP: GNU C. The latter has to be available on a zillion platforms, but because of that not optimizations can be implemented. To summarize: you might end up with a faster GIMP if you use VS for compilation. The other advantage is that quite a few developers feel comfortable in VS. That might attract new developers to GIMP.
Quote
There is no such thing as VS support. To use GIMP# with Visual Studio you would just have to import it. Pretty straightforward.
#17
Posted 11 December 2007 - 07:58 AM
Maybe one of the operators can add it to the end of the poll?
#18
Posted 11 December 2007 - 11:30 AM
#19
Posted 11 December 2007 - 11:45 AM
Quote
Thanks! It's quite unlikely that someone will vote for "other" anyhow, given the languages that are already on the list. Unless someone would really like to write a GIMP plug-in in for example Fortran :w:
#20
Posted 11 December 2007 - 02:07 PM

Help















