Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inconsistent outcomes with batch processing
#1
Hi all - first time poster here
I am interesting in using the batch processing mode and have copied some script code from
https://bsenduran.blogspot.com/2017/09/r...mp-in.html
and it is working within the script-fu console.
So far, so good
When I try to run the same script from a command line, using syntax like this

"C:\Program Files\GIMP 2\bin\gimp-2.10.exe" -b '(timbo "C:\\Folder1\\Folder2\\*.JPG" 0.5)'
(I've tried single and double backslashes in the path passed)

I have had three basic types of outcome - I had a few occasions when a second console window opened up and, in this, I got a message to say that the batch file had completed successfully

Then, I must have done something, but I don't know what - because I then went through a phase when I didn't get the 2nd console window up - I get a 'wait' cursor for a few seconds and nothing seemed to have happened - the files weren't processed

Now, I've noticed that if I pass an invalid path to GIMP in the command line parameters, I get a different outcome again, which is a 2nd console window which contains the message
"Batch commands cannot be run in existing instance in Win32"
I am running 64 bit Windows 10 Home

Can anyone explain what is going on here?

Thanks in advance
Tim
Reply
#2
You cannot use single-quotes on a Windows command line.

Try this:
Code:
"C:\Program Files\GIMP 2\bin\gimp-2.10.exe" -b "(timbo \"C:\\Folder1\\Folder2\\*.JPG\" 0.5)"
Reply
#3
(04-26-2019, 12:48 PM)Kevin Wrote: You cannot use single-quotes on a Windows command line.

Try this:
Code:
"C:\Program Files\GIMP 2\bin\gimp-2.10.exe" -b "(timbo \"C:\\Folder1\\Folder2\\*.JPG\" 0.5)"

Normally you don't need backslashes in file names (the only place where these need to be backslashes is "naked" file names in a command prompt) so


Code:
"C:/Program Files/GIMP 2/bin/gimp-2.10.exe" -b "(timbo \"C:/Folder1/Folder2/*.JPG\" 0.5)"

would work just as well.
Reply
#4
(04-26-2019, 11:27 AM)TimHaydnJones Wrote: Hi all - first time poster here
I am interesting in using the batch processing mode and have copied some script code from
https://bsenduran.blogspot.com/2017/09/r...mp-in.html
and it is working within the script-fu console.
So far, so good
When I try to run the same script from a command line, using syntax like this

"C:\Program Files\GIMP 2\bin\gimp-2.10.exe" -b '(timbo "C:\\Folder1\\Folder2\\*.JPG" 0.5)'
(I've tried single and double backslashes in the path passed)

They should really require a blogging license...

With ImageMagick, no need to write a single line of code:

Code:
mogrify -quality 50 C:\Folder1\Folder2\*.JPG

Many things you want to do in batch can be done (and are more efficiently done) with ImageMagick, which is designed to be called from the command line. For instance, when I want an easy to distribute lo-res version of the photos from my camera:

Code:
convert "$f" -modulate 100,120 -geometry 3000 -sharpen 0x1.0 -quality 85 "$dir/$(basename "$f" .JPG).jpg"

(this is Linux shell, but Windows shell is similar). In this one-liner:
  • modulate increases the color saturation (my camera is set on rather bland colors, easier to edit)
  • geometry scales down the image  (3000px along longest edge)
  • sharpen sharpens slightly to mitigate some of the blur that comes with downscaling
  • quality sets the JPEG quality when saving the result.
If you really want to do your own Gimp scripts in batch, it can be easier to do it in Python: see here for an example.
Reply


Forum Jump: