Re: [Gimp-user] batch mode in gimp?

2013-08-03 Thread Josef Wolf
On Fr, Aug 02, 2013 at 08:18:58 +0200, Ofnuts wrote:
 On 08/02/2013 10:47 AM, Josef Wolf wrote:
 On Do, Aug 01, 2013 at 09:44:59 +0200, Ofnuts wrote:
 For such simple processing, you should consider using ImageMagick.
 Thanks for the pointer, Ofnuts!
 
 I am currently using IM. But my processing got so complicated, including
 various levels of quoting through muiltiple levels of schell scripts.
 
 I have a strong feeling that it is time for me to switch to a real, reliable
 programming language, which script-fu would be (so I hope).
 
 At the risk of raising some eyebrows, better switch to python.
 You'll find more uses for it outside of Gimp,

I know python and I know scheme (and a lot of other languages, if that
matters). Granted, I don't know the scheme dialect used by gimp.
I'd rather use any lisp dialect in favour of python. I started to learn
python, but I broke, since I just can't get used to python's lambda's. Due to
the indentation syntax, defining lambda's seems to be very ambiguous to me.

OTOH, I'd probably never need lambdas for picture manipulation 8-)

What about perl? how stable are perl's bindings to gimp?

 and inside Gimp you
 can do more things with it than with script-fu (like create your own
 dialogs...). It is also a thousand times more readable.

Ough? Isn't script-fu the _primary_ scripting language for gimp? How comes
that python, which is working on top of the primary language can be more
reliable than the primary language?

Maybe my best bet would be cl-magick? Unfortunately, all the links on
http://common-lisp.net/project/cl-magick/ seem to be dead :-(

-- 
Josef Wolf
j...@raven.inka.de
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-03 Thread Ofnuts

On 08/03/2013 11:57 AM, Josef Wolf wrote:

On Fr, Aug 02, 2013 at 08:18:58 +0200, Ofnuts wrote:

On 08/02/2013 10:47 AM, Josef Wolf wrote:

On Do, Aug 01, 2013 at 09:44:59 +0200, Ofnuts wrote:

For such simple processing, you should consider using ImageMagick.

Thanks for the pointer, Ofnuts!

I am currently using IM. But my processing got so complicated, including
various levels of quoting through muiltiple levels of schell scripts.

I have a strong feeling that it is time for me to switch to a real, reliable
programming language, which script-fu would be (so I hope).

At the risk of raising some eyebrows, better switch to python.
You'll find more uses for it outside of Gimp,

I know python and I know scheme (and a lot of other languages, if that
matters). Granted, I don't know the scheme dialect used by gimp.
I'd rather use any lisp dialect in favour of python. I started to learn
python, but I broke, since I just can't get used to python's lambda's. Due to
the indentation syntax, defining lambda's seems to be very ambiguous to me.

OTOH, I'd probably never need lambdas for picture manipulation 8-)

What about perl? how stable are perl's bindings to gimp?


I don't think anyone is still using them these days.

and inside Gimp you
can do more things with it than with script-fu (like create your own
dialogs...). It is also a thousand times more readable.

Ough? Isn't script-fu the _primary_ scripting language for gimp? How comes
that python, which is working on top of the primary language can be more
reliable than the primary language?


Define primary. Historically first, yes... but all script-fu bindings 
are also availabe as python-fu ones, and the python interpreter you use 
has likely several millions more lines of code executed under its belt 
than Scheme, so its stability cannot really be a concern. Python-fu 
isn't written on top of Scheme but on the side... And just in case, I 
said 'readable', not 'reliable'... for instance in Python you can access 
some member of an aggregate using mnemonic names and not random bursts 
of C,A,D,R,(,)



Maybe my best bet would be cl-magick? Unfortunately, all the links on
http://common-lisp.net/project/cl-magick/ seem to be dead :-(


Not sure that would be a significant progress...
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-03 Thread Kevin Cozens

On 13-08-03 05:57 AM, Josef Wolf wrote:

I know python and I know scheme (and a lot of other languages, if that
matters). Granted, I don't know the scheme dialect used by gimp. I'd
rather use any lisp dialect in favour of python. I started to learn
python, but I broke, since I just can't get used to python's lambda's.
Due to the indentation syntax, defining lambda's seems to be very
ambiguous to me.


If you know Scheme then you know the Scheme of Script-Fu. The TinyScheme
interpreter used in Script-Fu follows the official Scheme standard as
documented in the R5RS but it is not a full implementation of R5RS.

I finally started learning to work with Python by writing a new GUI for
avrdude using wxGlade and wxPython. I don't find using indentation in Python
to be much of a problem (so far) but doing the GUI doesn't use much of
Python. I might have more issues with it when I do something more
complicated. The general rule seems to be that you indent anywhere you would
have used { } if one was writing in C.


What about perl? how stable are perl's bindings to gimp?


They are so stable you could measure the dust that has settled on the
bindings in inches. ;)

The gimp-perl binding is in need of a lot of TLC. It really needs a complete
overhaul. It has not been kept up-to-date with changes in GIMP. I have too
many other projects on my plate so I haven't touched the Perl binding in a
long time.


Isn't script-fu the _primary_ scripting language for gimp? How comes
that python, which is working on top of the primary language can be more
 reliable than the primary language?


Script-Fu has been part of GIMP for many years. Whatever operating system
you are running when you use GIMP, Script-Fu is there. Other bindings, such 
as Python, rely on external programs or packages (e.g. a Python 
interpreter). Some operating systems ship with Python already installed and 
some do not (or have not in the past). That has been addressed in some cases 
by the GIMP installer including the option to install Python if a user needs it.


The Python, Perl, and Ruby language bindings (to name three bindings) do not 
operate on top of Script-Fu. They are completely independent of Script-Fu. 
Any language binding can still invoke a procedure supplied as part of 
Script-Fu if desired.



Maybe my best bet would be cl-magick? Unfortunately, all the links on
http://common-lisp.net/project/cl-magick/ seem to be dead :-(


The top two links from a simple search using Google returned:
http://common-lisp.net/project/cl-magick/
http://www.cliki.net/cl-magick

--
Cheers!

Kevin.

http://www.ve3syb.ca/   |Nerds make the shiny things that distract
Owner of Elecraft K2 #2172  | the mouth-breathers, and that's why we're
| powerful!
#include disclaimer/favourite | --Chris Hardwick
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-03 Thread Kevin Cozens

On 13-08-03 08:37 AM, Grue wrote:

Script-Fu API is also more consistent than Python's (almost everything is
an integer, and all gimp library functions return a list of return
values), so Procedure Browser is also a complete documentation of the
library.


There are a couple of minor points one has to keep in mind when reading the 
information provided by the PDB while working on SF scripts. Apart from 
that, the procedure browser does provide a (mostly?) complete documentation 
of the library.



Granted, it would be nice if GIMP included a more powerful Lisp (such as
ECL, Embeddable Common Lisp), but Script-Fu's Tinyscheme is surprisingly
fun to program in.


There have been discussions where people have said GIMP should use a more 
complete Scheme implementation. Guile was mentioned in particular in those 
discussions. SF has tried to stay small by using a small Scheme interpreter. 
It let's you automate tasks in GIMP and you can do some reasonably complex 
tasks. However, it does have its limitations and there are times when a more 
full featured programming language is useful. To that end, there other 
language bindings available one can use.


--
Cheers!

Kevin.

http://www.ve3syb.ca/   |Nerds make the shiny things that distract
Owner of Elecraft K2 #2172  | the mouth-breathers, and that's why we're
| powerful!
#include disclaimer/favourite | --Chris Hardwick
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Josef Wolf
On Fr, Aug 02, 2013 at 03:32:55 +1200, Jehan Pagès wrote:
 You can do it this way. Tested by myself right now and working well:
 
 $ gimp-2.9 -i -d -f -s -b `cat script.scm` (simple-unsharp-mask
 \file.png\ 5.0 0.5 0) -b '(gimp-quit 0)'
 
 So basically you could have your small shell script call-gimp-function
 with the following code inside:
 
 --
 #!/bin/sh
 
 gimp-2.9 -i -d -f -s -b `cat \$1\` $2 -b '(gimp-quit 0)'
 --
 
 Then you can call it this way:
 $ ./call-gimp-function script.scm (simple-unsharp-mask \file.png\ 5.0 0.5 
 0)

Thanks for your suggestion, Jehan!

In fact, that's what I'm currently doing. But I thought there must be a better
way, since this is very prone to quoting errors. I got hidden badly when I
tried to pass a color definition as a quoted scheme list =:8O

 I think it should work well even if there are double quotes in the
 definition script because I think cat escapes them before feeding the
 contents to the main command.

I'd rather redirect stdin instead of using cat.

PS: where can I find information about how to access operating system (files,
directories, environment, etc) from script-fu? I've been searching for
TinyScheme ducumentation but could not find anyting. There seems to be
something like txn extensions and re extensions. But they don't seem to be
available from script-fu? Any hints?

-- 
Josef Wolf
j...@raven.inka.de
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Josef Wolf
On Do, Aug 01, 2013 at 09:44:59 +0200, Ofnuts wrote:
 For such simple processing, you should consider using ImageMagick.

Thanks for the pointer, Ofnuts!

I am currently using IM. But my processing got so complicated, including
various levels of quoting through muiltiple levels of schell scripts.

I have a strong feeling that it is time for me to switch to a real, reliable
programming language, which script-fu would be (so I hope).

-- 
Josef Wolf
j...@raven.inka.de
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Maurizio Loreti
IMHO, the best candidate for these repetitive jobs is ImageMagick - as
suggested before by ofnuts.  Or with a shell script invoking convert (as
shown in the example) or (if you have some programming experience) with a
simple C program using the Magick shared library.  In this way i wrote a
simple program to resize images, adjusting the quality in order to generate
a file not bigger than a specified limit.



On Fri, Aug 2, 2013 at 10:37 AM, Josef Wolf j...@raven.inka.de wrote:

 On Fr, Aug 02, 2013 at 03:32:55 +1200, Jehan Pagès wrote:
  You can do it this way. Tested by myself right now and working well:
 
  $ gimp-2.9 -i -d -f -s -b `cat script.scm` (simple-unsharp-mask
  \file.png\ 5.0 0.5 0) -b '(gimp-quit 0)'
 
  So basically you could have your small shell script call-gimp-function
  with the following code inside:
 
  --
  #!/bin/sh
 
  gimp-2.9 -i -d -f -s -b `cat \$1\` $2 -b '(gimp-quit 0)'
  --
 
  Then you can call it this way:
  $ ./call-gimp-function script.scm (simple-unsharp-mask \file.png\ 5.0
 0.5 0)

 Thanks for your suggestion, Jehan!

 In fact, that's what I'm currently doing. But I thought there must be a
 better
 way, since this is very prone to quoting errors. I got hidden badly when I
 tried to pass a color definition as a quoted scheme list =:8O

  I think it should work well even if there are double quotes in the
  definition script because I think cat escapes them before feeding the
  contents to the main command.

 I'd rather redirect stdin instead of using cat.

 PS: where can I find information about how to access operating system
 (files,
 directories, environment, etc) from script-fu? I've been searching for
 TinyScheme ducumentation but could not find anyting. There seems to be
 something like txn extensions and re extensions. But they don't seem to be
 available from script-fu? Any hints?

 --
 Josef Wolf
 j...@raven.inka.de
 ___
 gimp-user-list mailing list
 List address:gimp-user-list@gnome.org
 List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list




-- 
(@_  |
//\  | Maurizio Loreti - Fisico in pensione, nonno felice di
V_/_ | due nipotini, vagabondo e fotografo a tempo perso...
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Josef Wolf
On Fr, Aug 02, 2013 at 10:56:14 +0200, Maurizio Loreti wrote:
 IMHO, the best candidate for these repetitive jobs is ImageMagick - as
 suggested before by ofnuts.

I agree with this -- as long as your operations are simple.

But when your operations get more complex and involve things like like
stacking, multiple layers, etc/pp, things get very complicated because the
expressiveness and syntax/semantics are very limited by convert's very limited
command line interface.

-- 
Josef Wolf
j...@raven.inka.de
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Maurizio Loreti
On Fri, Aug 2, 2013 at 2:22 PM, Paul Cartwright pbcartwri...@gmail.comwrote:

 On 08/02/2013 04:56 AM, Maurizio Loreti wrote:
 I would be interested in a script that does resizing.. I do that on most
 of my images to send in email  add to web pages.. Sometimes I use my
 Samsung Galaxy camera, other times my Nikon  raw images..
 I'm pretty good with shell scripts, if I have a template:)


It is not a shell script, but c C++ program using the Magick++ library.
 You may fine the program  opening the following directory on Google
Documents:

https://drive.google.com/folderview?id=0B1oP_87P_BIOOGRiYTU5ZTMtODI0Ni00Mzc3LTgyZjAtNzgwMTM3ZmNlM2Q4usp=sharing

and entering the subdirectory photo batch resizing.  GPL license; enjoy!

P.S.: you will need the Magick++ shared library and the GNU getopt library;
read the enclosed man page, or the README.pdf file.


-- 
(@_  |
//\  | Maurizio Loreti - Fisico in pensione, nonno felice di
V_/_ | due nipotini, vagabondo e fotografo a tempo perso...
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Ofnuts

On 08/02/2013 10:47 AM, Josef Wolf wrote:

On Do, Aug 01, 2013 at 09:44:59 +0200, Ofnuts wrote:

For such simple processing, you should consider using ImageMagick.

Thanks for the pointer, Ofnuts!

I am currently using IM. But my processing got so complicated, including
various levels of quoting through muiltiple levels of schell scripts.

I have a strong feeling that it is time for me to switch to a real, reliable
programming language, which script-fu would be (so I hope).


At the risk of raising some eyebrows, better switch to python. You'll 
find more uses for it outside of Gimp, and inside Gimp you can do more 
things with it than with script-fu (like create your own dialogs...). It 
is also a thousand times more readable.

___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Ofnuts

On 08/02/2013 02:22 PM, Paul Cartwright wrote:


I would be interested in a script that does resizing.. I do that on most
of my images to send in email  add to web pages.. Sometimes I use my
Samsung Galaxy camera, other times my Nikon  raw images..
I'm pretty good with shell scripts, if I have a template:)

http://www.imagemagick.org/Usage/files/
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list


Re: [Gimp-user] batch mode in gimp?

2013-08-02 Thread Brendan Scott

On 08/03/2013 04:18 AM, Ofnuts wrote:

On 08/02/2013 10:47 AM, Josef Wolf wrote:

On Do, Aug 01, 2013 at 09:44:59 +0200, Ofnuts wrote:

[]


I have a strong feeling that it is time for me to switch to a real, reliable
programming language, which script-fu would be (so I hope).


At the risk of raising some eyebrows, better switch to python. You'll find more 
uses for it outside of Gimp, and inside Gimp you can do more things with it 
than with script-fu (like create your own dialogs...). It is also a thousand 
times more readable.


+1
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list