stdout from lisp
This discussion is connected to the gimp-developer-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.
Script-Fu | Markus Triska | 02 Jul 23:35 |
Script-Fu | Jonathan Bartlett | 02 Jul 21:39 |
Script-Fu | Markus Triska | 03 Jul 02:14 |
Script-Fu | Jonathan Bartlett | 03 Jul 00:12 |
Script-Fu | Markus Triska | 03 Jul 02:37 |
stdout from lisp | Kovacs Baldvin | 08 Apr 16:09 |
Script-Fu
(define (blur-file) (set! return "blur.png"))
but that would not (really?) allow constructs like:
file_for_blur: blur.png file_for_blur: blur_changed_my_mind_use_this_instead_but_keep_other_too.png file_for_blur: use_yet_another.png
You mean like (define blur-file "blur.png")?
Moreover, does there exist reference documentation for basic Gimp-Scheme things (tutorials aside), like string-append etc.? Some standard Lisp-functions don't seem to be implemented ("nth" for example) Should I add some? Which ones?
I think it's mostly R4RS with some stuff missing. I've _never_ found definitive documentation on GIMP-scheme.
Jon
Script-Fu
Hello,
I am currently working on a script-fu to provide previews of the more popular plug-ins with varying parameters. The script takes a list of images (blur.png, iir.png, rle.png, despeckle.png etc.), applies the respective plug-in with varying parameters and writes blur1.png, blur2.png, ..., blur(n).png, iir1.png, iir2.png, ..., iir(m).png etc., along with a file that records which filter/parameters were used for which image, for example:
blur1.png: filter Blur Percent 20 Count 5
blur2.png: filter Blur Percent 40 Count 10
...
iir1.png: filter "Gaussian Blur (IIR)" Radius 3 Horizontal 7 Vertical 5
...
edge.png: filter Edge Amount 2 "Wrap Mode" SMEAR Algorithm Differential
The thing is: The "print" command ("(print "test")" ) is not working for me in batch-mode (Gimp 2.0.2). It does what it should on the Script-FU console, but shows no output when used like
gimp -c -i -d -b '(filter-previews)' '(gimp-quit 0)'
A more simple case: When I create this file ("testprint.scm") in ~/gimp-2.0/script/:
(define (testprint) (print "this is a test"))
and invoke
gimp -c -i -d -b '(testprint)' '(gimp-quit 0)'
I get:
batch command: executed successfully.
(and nothing else)
Is this a bug?
Another question: Can I - in Gimp-scheme - define the C-equivalent to variables declared "static" (at global, not procedural, level), that is, variables that are global (i.e., visible in all procedures), but only in a particular file?
If not, can I declare variables that are *global*? How?
I need this for the mapping of filters respective input-files, for example, I could use this:
file_for_blur: blur.png file_for_iir: iir.png
I know that I can always use "define", like
(define (blur-file) (set! return "blur.png"))
but that would not (really?) allow constructs like:
file_for_blur: blur.png file_for_blur: blur_changed_my_mind_use_this_instead_but_keep_other_too.png file_for_blur: use_yet_another.png
that is, set the variable to a different value on the fly (without the need to comment out anything).
Moreover, does there exist reference documentation for basic Gimp-Scheme things (tutorials aside), like string-append etc.? Some standard Lisp-functions don't seem to be implemented ("nth" for example) Should I add some? Which ones?
Markus.
Script-Fu
(define blur-file "blur.png")
(define blur-file "otherblur.png")Different versions of Scheme handle this differently. I do not know if this is proper Gimp-scheme (re-defining a defined variable), or if one would have to use set! for the second definition/assignment. Incidently, no script-fu seems to make use of global variables, only of local let* - environments.
Perhaps (define ...) is equivalent to (set! ...) here?
I don't know "officially", but it seems that with any definition of define, you can define it first, and then set! it everywhere else. Even if your first define is
(define blur-file '())
Jon
Script-Fu
(define (blur-file) (set! return "blur.png"))
but that would not (really?) allow constructs like:
file_for_blur: blur.png file_for_blur:
blur_changed_my_mind_use_this_instead_but_keep_other_too.png file_for_blur: use_yet_another.pngYou mean like (define blur-file "blur.png")?
Yes exactly - I do not know how this would turn out in Gimp-Scheme (and especially of course in versions to come):
(define blur-file "blur.png") (define blur-file "otherblur.png")
Different versions of Scheme handle this differently. I do not know if this is proper Gimp-scheme (re-defining a defined variable), or if one would have to use set! for the second definition/assignment. Incidently, no script-fu seems to make use of global variables, only of local let* - environments.
Perhaps (define ...) is equivalent to (set! ...) here?
Markus.
Script-Fu
I don't know "officially", but it seems that with any definition of define, you can define it first, and then set! it everywhere else. Even if your first define is
(define blur-file '())
Yes, and what's more, one can also use set! alone (without a preceding "define"). I do not know if this is common practice in Scheme implementations nor if this will change when switching to Guile.
Markus.
stdout from lisp
Before I post my question to the list, I looked up the archives. Good for me, because I have found the exact same question in a 2 year old mail, unfortunately no answers.
So may I ask the same question? If anybody has information about it, please share it. I'd like to develop scripts using gimp, and it would be so nice to be able to debug with printing to the standard output...
Here is the question, originally from Markus Triska:
The thing is: The "print" command ("(print "test")" ) is not working for me in batch-mode (Gimp 2.0.2). It does what it should on the Script-FU console, but shows no output when used like
gimp -c -i -d -b '(filter-previews)' '(gimp-quit 0)'
A more simple case: When I create this file ("testprint.scm") in ~/gimp-2.0/script/:
(define (testprint) (print "this is a test"))
and invoke
gimp -c -i -d -b '(testprint)' '(gimp-quit 0)'
I get:
batch command: executed successfully.
(and nothing else)
Is this a bug?
And if it is: how does one work it around, so how to print to stdout?
Best regards, Baldvin Kovacs