Re: making a script



houghi <houghi@xxxxxxxxxxxxxxxxxx> wrote:
In this I am using 'fuzzy-borders' as an example, not as a goal in
itself. That is why I started a new thread.

I got as far as the following:
gimp -i -d -b "(script-fu-fuzzy-border \"foo.png\" RUN-NONINTERACTIVE
\'(100;100;100) 100 0 16 0 0 0 1)" -b '(gimp-quit 0)'
batch command: executed successfully.

However it does not seem to pick up the image. In fact wether the image
exists or not is irrelevant of the outcome.

I have used gimp's batch processing only slightly, so
I'm no expert on this. But there is at least one
obvious problem, which quite general in scope too.

You are using the batch mode to execute a scheme script
that operates on a previously loaded image. The scheme
script was written be a menu option available for
interactive users, and does nothing to load such an
image. Note that "foo.png" is not an image, it is a
*file*, and the "script-fu-fuzzy-border" function
requires an image for the first argument. (I can't
relate argument list in the example command above to the
argument list required by script-fu-fuzzy-border.)

To use the "script-fu-fuzzy-border" function in batch
mode you need to first execute the required gimp
functions to load an image by reading one from a file.

That could be done with prior -b options specifying one
or more gimp functions that would accomplish whatever is
required to have gimp in a state that allows
'script-fu-fuzzy-border' to work. Or, the most likely
way to accomplish that is to write a separate script
that calls all of the functions in order, and use that
in the command line with the -b option rather than
having -b options for each function needed.

That is generally true of *every* function available via
the batch processing. It is either a script written to
be executed as a batch, or it needs one to be used.

If I remember right there was mention in this thread
previously of the best example available on the the WEB
for how to do that, which is the one that does Unsharp
Mask.

In addition, the two Unsharp Mask example scripts for
use in batch mode have another characteristic that needs
to be addressed as part of the learning curve for
writing batch mode scripts. The simple one is just
that, too simple!

It loads one file, applies USM, and writes the file back
to disk. Two problems... you just lost your original
file, and if the applied USM is not exactly correct, you
had better have backup! That of course can be handled
manually outside of the gimp script, but you do need to
know about it and avoid working on unique image files that
are not backed up.

The second problem is that the script does only one
file, and that means gimp must be loaded for every file
the script is executed on, which makes it horribly slow
for any number of files larger than a handful. Usually
a large number of files is the exact reason a script is
written, so that is an important deficit.

What it means in simple terms is that the "simple"
script is good for learning, but it is not of much value
for production. The second variation, which will
operate on multiple files as specified on the command
line, is the one use as a starting point to build your
own batch scripts.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • CGIscript.net - csMailto.cgi - Remote Command Execution
    ... CGIscript.net - csMailto.cgi - Remote Command ... csMailto is a perl cgi formmail script developed by ... execute command on server and mail output to anyone ...
    (Bugtraq)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.questions)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.shell)
  • =?iso-8859-1?Q?Re:_Jcl?=
    ... I can send you a program that you execute as a step in your job and it ... I have a command and job scheduler that is available in a free version ... demand script processor with the full scripting ability so that your job ...
    (bit.listserv.ibm-main)
  • Re: sms installer- automate installing local printer
    ... Thanks Terry- Here is the script that I used that seemed to work- I just had ... > However since you are asking about getting the command line to work we can ... execute program this is where you are making the most mistakes. ...
    (microsoft.public.sms.installer)