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" 
> "<Image>/File/Save ALL" 
> "Save all opened images" 
> "Saul Goode" 
> "Saul Goode" 
> "11/21/2006" 
> "" 
> ) 
> 
> What did i do wrong?
> _______________________________________________
> Gimp-user mailing list
> Gimp-user@lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
> 
================
My first thought is: "Why not save them as they are created? Why wait?"
No answer needed.  The "why" is not the point, that it doesn't do the 
request is.

SO - why do you create the path/individual file name twice in one line?


(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
       )
     )
   )
))         double check the paren counts.  See if I got this right.


Steve

_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to