Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modifying DivideScannedImages Batch-Mode
#1
Hello,

since a while I've been using the (I think very good) script "https://github.com/FrancoisMalan/DivideScannedImages"

But one thing isn't optimal for me in Batch-Mode: all the picture that were processed get the name "Crop..." with a number.
It would be more useful to have (also) the original file name in the output name.

In Batchmode there already exists the variable "filename", but when I put it in in the line with the output


Code:
(set! newFileName (string-append targetDir pathchar filename inFileName 

then I get "Error: eval: unbound variable: filename "


I supposed the problem is that the variable is not declared, so I put it in the line for the batch-part:


Code:
(define (script_fu_BatchDivideScannedImages inSourceDir inLoadType inSquareCrop inPadding inLimit inDeskew inAutoClose inThreshold inSize inDefBg inBgCol inCorner inX inY inSaveInSourceDir inDestDir inSaveType inJpgQual inFileName inFileNumber filename)

But than I get "Error: not enough arguments"

What I'm doing wrong? 

PS.: I'm using Gimp 2.10.36 under Linux Mint 64bit
Reply
#2
yeah, script-fu death by a thousand parentheses

Maybe a starting point adding a line to set inFileName to the image name. about line 207

Code:
(set! inFileName  (car (gimp-image-get-name img)))

            (set! newFileName (string-append targetDir pathchar inFileName
                                     (substring "00000" (string-length (number->string (+ inFileNumber numextracted))))
                                     (number->string (+ inFileNumber numextracted)) saveString))

Unfortunately that uses the full name including the file extension, so a chunk of code needed to parse the file name - maybe somebody can advise.

That for example on a couple of png test images gives
a.png -> a.png00001.jpg a.png00002.jpg
b.png -> b.png00003.jpg b.png00004.jpg b.png00005.jpg
Reply


Forum Jump: