Re: [Gimp-user] Script-fu in GIMP - and batch processing.



On 2021-06-09 11:22 a.m., ludo0565 dbmail com wrote:
            (let* ((filename (car filelist))
                   (filenamenew (string-append (car filelist) "-new")) ; as well as (filenamenew (string-append 
filename "-new"))
                   (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 filenamenew filenamenew)
[snip]
calling the programme with this command:

gimp -i -b '(batch-unsharp-mask "*.JPG" 5.0 0.5 0)' -b '(gimp-quit 0)'

Unfortunately I did not have the expected success, as I got this result:

batch command experienced an execution error: Error: Procedure execution of gimp-file-save failed: unknown 
file type

If the first entry in the list is "somefile.JPG" what you have above will attempt to save out a new version with the name "somefile.JPG-new".

What you need to do is get the root filename "somefile" and append "-new.JPG" to create the new filename of "somefile-new.JPG".

The simplest way to handle the situation is to read the files from one directory and save the modified version to another. The not so easy method is to split the string on the . in the filename in to "simefile" and ".JPG" so you can create a string with the new name for the modified file.

--
Cheers!

Kevin.

http://www.ve3syb.ca/               | "Nerds make the shiny things that
https://www.patreon.com/KevinCozens | distract the mouth-breathers, and
                                    | that's why we're powerful"
Owner of Elecraft K2 #2172          |
#include <disclaimer/favourite>     |             --Chris Hardwick


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]