GIMP Chat http://gimpchat.com/ |
|
Seeking Help with First Multi-File Batch Script http://gimpchat.com/viewtopic.php?f=8&t=17840 |
Page 1 of 1 |
Author: | EC [ Mon Dec 02, 2019 11:22 pm ] |
Post subject: | Seeking Help with First Multi-File Batch Script |
GIMP Version: 2.10.14 Operating System: Windows OS Version: 10 GIMP Experience: Intermediate Level List any relevant plug-ins or scripts: goode-mirror-duplicates.scm Hello, I just discovered batch scripts today for the first time through the official GIMP Batch Mode guide. I'm looking to do a multiple file operation of thousands of images to mirror them (mirroring the whole image horizontally, yielding an image twice the width in the end). I found a working scm script which is capable of doing this within the GIMP GUI, "goode-mirror-duplicates.scm," which seems like a great start, but I have been trying to figure out how to apply it automatically to a directory of files with no luck. So far, I have attempted to call it from a separate scm file which is just a modified version of the 2nd code in the guide I mentioned. Code: Select all (define (batch-mirror-dup pattern iterations horizontal vertical workcopy) And running it from cmd like follows: Code: Select all gimp-2.10 -i -b '(batch-mirror-dup "*.png" 1 TRUE FALSE FALSE)' -b '(gimp-quit 0)' When running the batch above, nothing happens. CMD simply returns to a new line for me to enter another command. This is my first time with this, and I'm not sure what to do. Any help is appreciated. EDIT: See post below |
Author: | EC [ Mon Dec 02, 2019 11:52 pm ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
Okay I've made some progress from looking over this forum (I wish this forum turned up in search engine results!) It turns out I needed to call gimp-console rather than gimp yes? Now I get this: Code: Select all Exception code=0xc0000005 flags=0x0 at 0x000000000067DD33. Access violation - attempting to read data at address 0x0000000000000000 I'm going to keep looking over the threads on this forum as it seems like a great resource though! EDIT: More progress, figured out that I need to use " instead of ' in CMD. Now a lot of stuff is getting printed out but no dice. EDIT2: It seems that both my script and also the example script on the official guide end in the same error: "Error: eval: unbound variable: *.png" |
Author: | EC [ Tue Dec 03, 2019 2:01 am ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
Following a stackoverflow post, ".png" needs to be changed to `.png` and it is correct to have two ' surrounding the parentheses In the end, the code is: "D:\Program Files\GIMP 2.8\bin\gimp-console-2.10" -i -b '(batch-mirror-dup `*.png` 1.0 TRUE FALSE FALSE)' -b '(gimp-quit 0)' The new issue is CMD Reports "batch command executed successfully" but the files are unchanged. EDIT: This seems to be the case with the example code too. Is it that I'm not defining a directory? EDIT2: Installed 2.8 and tried with it for same result |
Author: | paynekj [ Tue Dec 03, 2019 4:25 am ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
The official guide to writing scripts is incorrect for Windows command-lines. You cannot use single-quotes on the command line. Try this: Code: Select all "D:\Program Files\GIMP 2.8\bin\gimp-console-2.10" -i -b "(batch-mirror-dup \"*.png\" 1.0 TRUE FALSE FALSE)" -b "(gimp-quit 0)" Kevin |
Author: | EC [ Thu Dec 05, 2019 12:39 am ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
Hey paynekj, that looks to have solved my issue with the example code not working! Now I just need to figure out what's wrong with my code specifically, as it (unsurprisingly) didn't work for my code since it's my first attempt. Thank-you! |
Author: | EC [ Thu Dec 05, 2019 3:34 am ] | ||
Post subject: | Re: Seeking Help with First Multi-File Batch Script | ||
Alright so I've made good progress with the code. It does actually mirror an image now which is cool, but the problem is it only mirrors the first one for some reason. I'm guessing it's an issue with the logic but I've followed the logic and I'm not sure where. Can anyone spot the mistake? I've attached the file.
|
Author: | paynekj [ Thu Dec 05, 2019 8:40 am ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
Your problem may be that when you get to gimp-file-save you're saving image instead of work-image, which makes a difference if you've set workcopy to TRUE Kevin |
Author: | EC [ Thu Dec 05, 2019 10:10 pm ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
Thanks Kevin, good call. I changed that now but it still has the same behavior of only doing the operation to the first file though (I was running workcopy as false anyways, planning to remove that part of the code). Any other ideas? I think it might have something to do with the filelist interaction with the while loop but I don't know why. EDIT: I've determined the while loop is working correctly. It seems to be going to every file and doing stuff but not saving maybe? |
Author: | paynekj [ Fri Dec 06, 2019 7:15 am ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
I've edited the script to make it match how I like the code to look, and I've removed workcopy. I suspect that your problem may have been something to do with the undo mechanism, which I've also changed and now the script seems to work. Code: Select all ; |
Author: | EC [ Fri Dec 06, 2019 7:58 pm ] |
Post subject: | Re: Seeking Help with First Multi-File Batch Script |
Thank-you so much Kevin!! It works! |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |