Post Reply 

Batch problem

Mar 1, 2012, 12:08
Post: #1
Batch problem
I am a newbie having trouble getting the sample batch programs to run. I placed simple-unsharp-mask.scm in C:\.gimp-2.6\scripts and put the .bat file in the E: drive directory with the image file foo.png. When I run the .bat file on my PC running Vista, I get "batch command experienced an execution error." Here is the .bat file:

"C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i -b "(simple-unsharp-mask \"foo.png\" 5.0 0.5 0)" -b "(gimp-quit 0)"

Obviously, I am doing something wrong, but don't have a clue what it is. Thanks for your help.
Find all posts by this user
Quote this message in a reply
Mar 1, 2012, 14:28
Post: #2
RE: Batch problem
That seems to have helped a bit. Now, I get:
script-fu.exe-Warning: Error while loading C:\Users\Tom\.gimp-2.6\scripts\simple-unsharp-mask.scm:

Error: syntax error: illegal token 1

script-fu.exe-Warning: Error while loading C:\Users\Tom\.gimp-2.6\scripts\simple-unsharp-mask.scm:

Error: syntax error: illegal token 1

batch command executed successfully
script-fu.exe-Warning: Error while loading C:\Users\Tom\.gimp-2.6\scripts\simple-unsharp-mask.scm:

Error: syntax error: illegal token 1

Here is the simple-unsharp-mask.scm:

(define (simple-unsharp-mask filename
radius
amount
threshold)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-unsharp-mask RUN-NONINTERACTIVE image drawable radius amount threshold)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))
)))))
Find all posts by this user
Quote this message in a reply
Mar 1, 2012, 18:54
Post: #3
RE: Batch problem
Thanks for revising your advice. As you suspected, I simply copied an example from the tutorials. By deleting the extra close parens at the end, I got it run run without an error. I don't really understand what it was supposed to do to the image file, but it did update its modified by date in the directory and i don't see anything significantly different about the image now. For now, I'll assume that it's working and move on to a more complicated example.

Thanks again.
Find all posts by this user
Quote this message in a reply
Mar 1, 2012, 19:20
Post: #4
RE: Batch problem
Here's my feeble attempt at changing the threshold on a photo:

(define (simple-threshold-change filename
low-value
high-value)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-threshold low-value high-value)
(gimp-image-delete image)))

When running the following batch job

"C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i -b "(simple-threshold-change \"foo.png\" 75 255)" -b "(gimp-quit 0)"

I get "batch command experienced an execution error." Is more detail about errors logged in a file somewhere?

Thanks.
Find all posts by this user
Quote this message in a reply
Mar 1, 2012, 20:48
Post: #5
RE: Batch problem
I found the problem(s):
1. I left the drawable parameter out of the gimp-threshold call, and
2. left out the gimp-file-save call.

It now runs without error and gives the desired result.

Now, to expand it for all the images in a directory.

I'm sorry to be a bother.
Find all posts by this user
Quote this message in a reply
Mar 4, 2012, 16:02
Post: #6
RE: Batch problem
I now have a new problem. This time it has to do with executing gimp-edit-bucket-fill and (probably) not understanding the parameters required. The following is the batch job that errors out:

"C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i -b "(gimp-edit-bucket-fill \"foo1.png\" 0 0 0.0 128 1 56.0 80.0)" -b "(gimp-quit 1)"

I want the third from the last parameter to be false but am not sure if I should enter 0, 1 or FALSE. Trying each of them one at a time hasn't worked, quite possibly due to some other problem.

Thanks,

Tom
Find all posts by this user
Quote this message in a reply
Mar 5, 2012, 17:26
Post: #7
RE: Batch problem
My only excuse for being so stupid when I tried that is that I was tired. Doing what you suggested caused my script to run to completion but it changed nothing. I observed foo.png in Windows Explorer while the sctipt ran. The bottom ~5/6 of the image turned black but reverted to as it was in the beginning when the script completed. I am clearly missing something. Here are my procedure script and batch file:

(define (simple-bucket-fill filename
fill-mode
paint-mode
opacity
threshold
sample-merged
x
y)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-edit-bucket-fill drawable
fill-mode
paint-mode
opacity
threshold
sample-merged
x
y)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))



"C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i -b "(simple-bucket-fill \"foo.png\" 0 0 0.0 128 0 56.0 80.0)" -b "(gimp-quit 1)"

Thanks,

Tom
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  problem with window GerryZ 2 133 Jun 29, 2018 16:15
Last Post: GerryZ
Information Canvas Rotation Problem Fefe 1 129 May 19, 2018 20:32
Last Post: paynekj
  Opening an image problem mes2370 1 171 May 11, 2018 15:20
Last Post: paynekj
  pen ( stylus ) tip problem mick560 1 227 Dec 29, 2017 05:09
Last Post: ythgilb
  problem with drop shadow Kharl 37 3,654 Oct 8, 2014 04:53
Last Post: Kharl

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS