Gimptalk - Premier Gimp Community: Preferred programming language for GIMP plug-ins and scripts - Gimptalk - Premier Gimp Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Preferred programming language for GIMP plug-ins and scripts

#1 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 09 February 2007 - 11:02 AM

This poll asks for your preferred programming language for writing GIMP plug-ins. The first 4 languages (C, Script-fu, Perl and Python) have been supported for quite a long time. Most plug-ins are written in C. Scripts are usually written in Scheme, Perl or Python.

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.
0

#2 User is offline   saulgoode 

  • Retired Staff
  • PipPipPip
  • Group: Retired Staff
  • Posts: 5,324
  • Joined: 22-August 05

Posted 09 February 2007 - 02:59 PM

I took the liberty of adding GLUAS to your poll because I would be interested in learning if anyone is familiar with it. I don't use GLUAS myself but it would seem to play a role in the development of the GEGL (GEneric Graphical Library) which is slated to replace the core graphics engine of the GIMP after version 2.4.

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.
Everybody makes their own fun. If you don't make it yourself it's not fun, it's entertainment.
0

#3 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 09 February 2007 - 03:11 PM

Quote

I took the liberty of adding GLUAS to your poll...

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.
0

#4 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 25 November 2007 - 04:04 PM

I'm proud to tell that the Nemerle http://www.nemerle.org programming language is now supported in GIMP# :)
0

#5 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,288
  • Joined: 13-June 05

Posted 26 November 2007 - 12:00 AM

Maybe you can tell me if

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
0

#6 User is offline   saulgoode 

  • Retired Staff
  • PipPipPip
  • Group: Retired Staff
  • Posts: 5,324
  • Joined: 22-August 05

Posted 26 November 2007 - 02:00 AM

Consider the following analogy:

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.
Everybody makes their own fun. If you don't make it yourself it's not fun, it's entertainment.
0

#7 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,288
  • Joined: 13-June 05

Posted 26 November 2007 - 04:03 AM

I like a lot your analogy

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:
0

#8 User is offline   ulillillia 

  • Member
  • PipPip
  • Group: Members
  • Posts: 526
  • Joined: 23-March 06

Posted 26 November 2007 - 06:43 AM

C - it's the only language I know, but I don't make GIMP plug-ins since the way it's done for Windows isn't worthy so I just make stand-alone programs instead, as with the high-precision grayscale conversion thing that I have yet to make (I haven't had a need for it), and another for automating stage 5 of my animation-creation process (where I animate the scene), I haven't had the motive to doing it though it's increasing.
It's amazing what mathematics can do for artwork!
0

#9 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 26 November 2007 - 07:40 AM

@saulgoode: your analogy is brilliant. I especially love the way you compare GIMP# with an expensive waitress :h: Can I add that quote the GIMP# homepage?

@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.
0

#10 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,288
  • Joined: 13-June 05

Posted 26 November 2007 - 12:37 PM

@Maurits

Quote

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.

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 ...?
0

#11 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 26 November 2007 - 01:34 PM

Quote

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 ...?

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.
0

#12 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,288
  • Joined: 13-June 05

Posted 27 November 2007 - 12:36 PM

Quote

here 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.


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

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.


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"
0

#13 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 28 November 2007 - 12:05 PM

@PhotoComix (and others): at the moment I have contact with someone who has made some nice progress on compiling GIMP# for win32. He hasn't been able to run the plug-ins yet, but I'm working together with him to solve those issues. So there's still hope for a recent release on win32 :)
0

#14 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 30 November 2007 - 09:46 AM

As of this week there is now also support for Visual Basic and Boo (http://boo.codehaus.org/) in GIMP#. For the moment if you want to use it, you will have to get the latest version of GIMP# from CVS. It will of course be included in the next release of GIMP#, which will be version 0.14. I haven't fixed a date for this release yet, but it will certainly be before the end of this year.
0

#15 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,288
  • Joined: 13-June 05

Posted 30 November 2007 - 04:59 PM

Hum...maybe not strictly related but you or Saulgoode have any ...well idea or comment on this project
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)
0

#16 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 30 November 2007 - 06:50 PM

Quote

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 ?

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

And a similar solution may have some advantage versus, as example on adding VS support to GIMP# ?

There is no such thing as VS support. To use GIMP# with Visual Studio you would just have to import it. Pretty straightforward.
0

#17 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 11 December 2007 - 07:58 AM

I've added support for yet another language to GIMP#: this time it's F# (pronounced as fsharp) which is a pretty cool language. More information can be found here: http://cs.hubfs.net/.

Maybe one of the operators can add it to the end of the poll?
0

#18 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,288
  • Joined: 13-June 05

Posted 11 December 2007 - 11:30 AM

Done...since "other" had no vote till now i left at end (in this case this will not alter the results )
0

#19 User is offline   Maurits 

  • Member
  • PipPip
  • Group: Members
  • Posts: 273
  • Joined: 30-January 06

Posted 11 December 2007 - 11:45 AM

Quote

Done...since "other" had no vote till now i left at end (in this case this will not alter the results )

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:
0

#20 User is offline   greentunic 

  • GT Moderator
  • Group: Moderators
  • Posts: 2,766
  • Joined: 20-May 07

Posted 11 December 2007 - 02:07 PM

I haven't tried making a script or plugin for gimp yet, but I have some experience with C, C#, and a little Java.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic