Save all open - script
This discussion is connected to the gimp-user-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.
Save all open - script | Brandon | 01 Jul 17:51 |
Save all open - script | norseman | 02 Jul 00:20 |
- postings
- 1
Save all open - script
Hi all. Obviosuly I am new at this but I have been doing research into scripts and such for a while.
My current task at work is that i have to cut small 10x10 pixel areas out of a bigger bmp file and save them all as individual files.
I have the cutting and pasting to new file down pat, but once i have a hundred or so open, i want to just save all of them at once. I found a script on this list 'saveall.scm' but since these are all new untitled bmp files it would return an error.
I have modified it and i think i have it closer but i have one/two lines way wrong and I cant seem to get it right. All i want is for the script to take all the open images, append a new number on it, .bmp, and save them in a specific folder.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
(define (script-fu-save-all-images)
(define outDir "C:\\Documents and Settings\\bms\\My Documents\\temp bitmaps\\Unicode 10x10")
(define outFile)
(define imgNum)
(let* ((i (car (gimp-image-list)))
(image))
(while (> i 0)
(set! image (vector-ref (cadr (gimp-image-list)) (- i 1)))
;; THE next two lines i edited, they dont work
(number->string i imgNum)
(file-bmp-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-layer image)) (string-append outDir "\\" (car (gimp-image-get-name image)) "_" (imgNum) ".bmp") (string-append outDir "\\" (car (gimp-image-get-name image)) "_" (imgNum) ".bmp"))
(gimp-image-clean-all image)
(set! i (- i 1)))))
(script-fu-register "script-fu-save-all-images"
"/File/Save ALL"
"Save all opened images"
"Saul Goode"
"Saul Goode"
"11/21/2006"
""
)
What did i do wrong?
Save all open - script
Brandon wrote:
Hi all. Obviosuly I am new at this but I have been doing research into scripts and such for a while.
My current task at work is that i have to cut small 10x10 pixel areas out of a bigger bmp file and save them all as individual files.
I have the cutting and pasting to new file down pat, but once i have a hundred or so open, i want to just save all of them at once. I found a script on this list 'saveall.scm' but since these are all new untitled bmp files it would return an error.
I have modified it and i think i have it closer but i have one/two lines way wrong and I cant seem to get it right. All i want is for the script to take all the open images, append a new number on it, .bmp, and save them in a specific folder.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ;
; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details.(define (script-fu-save-all-images) (define outDir "C:\\Documents and Settings\\bms\\My Documents\\temp bitmaps\\Unicode 10x10") (define outFile)
(define imgNum)
(let* ((i (car (gimp-image-list)))
(image))
(while (> i 0)
(set! image (vector-ref (cadr (gimp-image-list)) (- i 1))) ;; THE next two lines i edited, they dont work (number->string i imgNum)(while (> i 0)
(set! image (vector-ref (cadr (gimp-image-list)) (- i 1))) (file-bmp-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-layer image)) (string-append outDir "\\" (car (gimp-image-get-name image)) "_" (imgNum) ".bmp") (string-append outDir "\\" (car (gimp-image-get-name image)) "_" (imgNum) ".bmp")) (gimp-image-clean-all image)
(set! i (- i 1)))))(script-fu-register "script-fu-save-all-images" "/File/Save ALL"
"Save all opened images"
"Saul Goode"
"Saul Goode"
"11/21/2006"
""
)What did i do wrong?