Sign up now! · Forgot password?
gimpusers.com RSS feed
58 @ identi.ca
819 @ Twitter

Some questions about script-fu and tinyscheme.

ForumsFor GIMP users ► Some questions about script-fu and tinyscheme.

Sent: 2007-08-22 01:43:38 UTC (over 4 years ago)

From: Pere Pujal i Carabantes

Some questions about script-fu and tinyscheme.

Hi!

The first is about writing text to a file.
In SIOD doing something like this I can write text to a file:

(let* (
(txt-output-file-name (string-append base-filename ".txt"))
(txt-output-file (fopen txt-output-file-name "w")))
(fwrite (string-append text-string "\n")txt-output-file)
(fclose txt-output-file))

If I try the same in tinyscheme it raises an error.
How can I do the same in tinyscheme?

For now, I've worked around as this, but looks ugly:

(begin
(define text-filename (string-append base-filename ".txt"))
(define txt-output-file (open-output-file text-filename))
(for-each (lambda (z)(write-char z txt-output-file ))(string->list
text-string))
(newline txt-output-file))

The second question is about the memory used by gimp-image-undo-group
start->end.
If I use this, my script easy eats all the memory. (It creates, moves
and destroys 49 layers per an undetermined number of runs)

I've created a simple script to test and show:
http://fornol.no-ip.org/linux/gimp/group-undo-test.scm
Defaults to create and destroy 20 layers x 5 runs = 100 layers and
group-undo each run.

Create a new blank image (420x300 pixels)
run the script on it script-fu-->test-->group-undo
If you check group-undo you will get an image about 193MB
If you don't check, the image will use 64.2MB

Well, I have setted 64MB as max undo memory, but why this set is not
used when grouping undo?

Thanks
Pere

» Reply to this message

Sent: 2007-08-22 22:36:21 UTC (over 4 years ago)

From: Pere Pujal i Carabantes

Some questions about script-fu and tinyscheme.

> Well, I have setted 64MB as max undo memory, but why this set is not
> used when grouping undo?

Solved this, that was a misconfiguration on my hand.
I had setted a minumun undo levels of 5 an this take precedence over the
max memory for undo.

Pere

» Reply to this message

Sent: 2007-08-23 19:30:24 UTC (over 4 years ago)

From: Pere Pujal i Carabantes

Some questions about script-fu and tinyscheme.

> For now, I've worked around as this, but looks ugly:
>

> (for-each (lambda (z)(write-char z txt-output-file ))(string->list
> text-string))

better as this:

(display text-string txt-output-file)

BTW The gimp script-fu console segfaults typing something like
(let* (a 1))
Should I post a bug report?

gimp 2.4.0-rc1

Yours
Pere

» Reply to this message