gimpusers.com logo
German version English version

Not logged in

Sign up! | Lost password?

Latest discussion

  1. gimp-user | today 09:49 AM
    Need help: "correcting" exposures in time-lapse imagesets
  2. gimp-developer | today 06:14 AM
    GIMP color-management spec and further discussion
  3. gimp-user | yesterday 11:13 PM
    collages in gimp?
  4. gimp-developer | yesterday 07:07 PM
    Color management (UI perspective for GIMP 2.8)
  5. gimp-user | yesterday 02:42 PM
    printing

External news

Poll

Would you like to be able to use your Google/Yahoo/MSN (OpenID) login on gimpusers, too?

Definately! I would enjoy the possibility to use my OpenID on different websites!

I don't have a special need for OpenID but I think it could be useful

Doesn't matter to me

Never, OpenID is a pain regarding privacy and personal data protection!

No. (please post a comment)

See results

Stats

gimpusers.com RSS feed

GIMP Forums » For GIMP users

Save all open - script

Jump to message:

  1. Save all open - scriptBrandon, 01 Jul 2009 05:51 PM
    1. Save all open - script — norseman, 02 Jul 2009 12:20 AM

As a registered user, you can subscribe forum threads in order to get notified when replies are posted. Just log in at the right top of the page if you already have an account, otherwise you can register for free.

Permalink:20090701155125.750C918026AC6@a.dev001...
Date:01 Jul 2009 05:51 PM
From:Brandon (gimpusers.com)
Subject: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"
"<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
↑Back to thread overview
Permalink:4A4BE163.9030703@hughes.net
Date:02 Jul 2009 12:20 AM
From:norseman
Subject: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"
> "<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

↑Back to thread overview

Adobe® Photoshop® is a registered trademark of Adobe Systems, Inc. Linux is a trademark of Linus Torvalds. Ubuntu and Canonical are registered trademarks of Canonical Ltd. | Clock times are shown as CET / CEST | Imprint / Privacy policy | powered by bitfire it services