It is currently Wed Apr 24, 2024 11:32 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: struggling with a batch to flip images
PostPosted: Wed Mar 25, 2015 10:50 pm  (#1) 
Offline
New Member

Joined: Mar 25, 2015
Posts: 2
Hello to the community here from yet another newbie again...

I want to horizontally flip a bunch of .png files in a folder, I tried to modify the sample script in the tutorial, but it does not seem to work as I see nothing and the images remain unaltered. Any idea what I am missing or where I can see what is going wrong ?

I copied this .scm file in the scripts folder.

(define (batch-flip image)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp_drawable_transform_flip_simple image ORIENTATION_HORIZONTAL True 0)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))

and I issue this command:
SET gimpEXE="C:\Program Files\GIMP 2\bin\gimp-2.8.exe" %gimpEXE -i -b '(batch-flip "*.png")' -b '(gimp-quit 0)'

Any help is greatly appreciated


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: struggling with a batch to flip images
PostPosted: Thu Mar 26, 2015 12:53 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
You have a couple of typos to start with.

Script-fu doesn't use underscores in the built-in function names and constants:
gimp_drawable_transform_flip_simple image
and
ORIENTATION_HORIZONTAL


From the presence of "Program Files" in your command line, you're on Windows? Well you can't use single-quotes to enclose the batch command:

"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" -i -b "(batch-flip \"*.png\")" -b "(gimp-quit 0)"


You've also defined the script as taking a variable called "image", but expect it to be called "pattern" when doing the file-glob

Kevin


Top
 Post subject: Re: struggling with a batch to flip images
PostPosted: Thu Mar 26, 2015 8:22 am  (#3) 
Offline
New Member

Joined: Mar 25, 2015
Posts: 2
whoops, me and typos, I should have copy pasted them, I am at the office at the moment but will try it as soon as I am home, thank you. Is there a debugging possibility in this environment ?


Top
 Post subject: Re: struggling with a batch to flip images
PostPosted: Thu Mar 26, 2015 10:03 am  (#4) 
Offline
Script Coder
User avatar

Joined: Dec 27, 2014
Posts: 508
I use this for debugging:
  (define (debug-message msg)
    (let
      ((handler (car (gimp-message-get-handler))))
      (gimp-message-set-handler ERROR-CONSOLE)      ;{ MESSAGE-BOX (0), CONSOLE (1), ERROR-CONSOLE (2) }
      (gimp-message (string-append "MyScript: " msg))
      (gimp-message-set-handler handler)
    )
  )

This will send a message prefixed with "MyScript: " to your Error Console if you have one activated (see <Image>Windows>Dockable Dialogues>Error Console). [Change the "MyScript" to the name your script.]

To display variables, preformat the message using (string-append ) and (number->string )
eg.
(debug-message "Hello world")                           produces "MyScript: Hello world"
(debug-message (string-append "x=" (number->string x)))         produces "MyScript: x=<value of x>"
(debug-message (string-append "x=" (number->string x) " y=" (number->string y)))        produces "MyScript: x=<value of x> y=<value of y>"


Top
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) converting 32 bit images to 8 bit using batch script

5

No new posts Attachment(s) Batch export all opened images script for GIMP [Update]

13

No new posts Struggling to write a basic script

4

No new posts Batch Create Layers

2

No new posts Attachment(s) Seeking Help with First Multi-File Batch Script

9



* Login  



Powered by phpBB3 © phpBB Group