GIMP Chat http://gimpchat.com/ |
|
Problem with a script-fu http://gimpchat.com/viewtopic.php?f=9&t=14213 |
Page 1 of 1 |
Author: | tahoser [ Tue Jun 14, 2016 10:45 am ] |
Post subject: | Problem with a script-fu |
Hello, I want to convert files with the extension .png to .gbr format on batch. To do that I used a script found on the web: brush-batch.scm. This one does not work on my computer that is why I used it to create a new one. My code is lauching but it stops during loading file. If you can help me to understand why that could be great. This is my code: (define (convert-pngtogbr load name location) (gimp-context-set-foreground '(0 0 0)) (gimp-context-set-background '(255 255 255)) (let* ( (filelist (cadr (file-glob (string-append load "\\*.png") 1))) (s 1) ) (while filelist (let* ( (loadfile (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE loadfile loadfile))) ) (set! drawable (gimp-image-get-active-drawable image)) (set! filename2 (string-append location "/" name ".gbr" )) (file-gbr-save 1 image drawable filename2 name 15 name)) (set! s (+ s 1)) (gimp-image-delete (car image)) (set! filelist (cdr filelist)))) ) (script-fu-register "convert-pngtogbr" "<Toolbox>/Xtns/Script-Fu/PngToGbr..." "Convert png to gbr" "XX" "XX" "Juin 2016" "" SF-DIRNAME "Load from" "" SF-STRING "Brush Name" "name" SF-DIRNAME "SAVE TO FOLDER" "") Thank you very much Best regards Tahoser |
Author: | paynekj [ Tue Jun 14, 2016 11:24 am ] |
Post subject: | Re: Problem with a script-fu |
It's so much easier to read if you put it in [ code ] tags: Code: Select all (define (convert-pngtogbr load name location) I've not tried it, but one obvious problem is that you've not defined drawable or filename2 before using them. Kevin |
Author: | tahoser [ Wed Jun 15, 2016 4:28 am ] |
Post subject: | Re: Problem with a script-fu |
Thank you for your information about code tag. I will use it now. filename2 is defined as that: Code: Select all (set! filename2 (string-append location "/" name ".gbr")) and drawable as that: Code: Select all (set! drawable (gimp-image-get-active-drawable image)) The problem seems to come from uploading file. On the screen, the dialog box closes at that time. Thank you Best regards Tahoser |
Author: | paynekj [ Wed Jun 15, 2016 5:21 am ] |
Post subject: | Re: Problem with a script-fu |
tahoser wrote: Thank you for your information about code tag. I will use it now. filename2 is defined as that: Code: Select all (set! filename2 (string-append location "/" name ".gbr")) and drawable as that: Code: Select all (set! drawable (gimp-image-get-active-drawable image)) No! You have to define something BEFORE you use set! otherwise you get this: Code: Select all > (set! fred 1) Kevin |
Author: | tahoser [ Wed Jun 15, 2016 8:21 am ] | ||
Post subject: | Re: Problem with a script-fu | ||
OK. Do you have an example? I join the code I used because I did not understand where and how I have to do what you said. Thank you
|
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |