jhingranamit wrote:
I am trying to use the "file-jpeg-save" from command line but getting error stating batch command experienced an execution error.
The code passed on the command line -- in your case, file-jpeg-save -- needs to be valid Script-fu, just as used within scripts. This means that second argument needs to be the image ID of an opened image, not the name of the file on disk. Your code needs to load the file as an image and then determine the layer ID of the image's layer before you can save the file as a JPEG.
Also, your command is looping through, opening GIMP for a file and then closing GIMP only to have to re-open GIMP for the next file. It is far better to just open GIMP once and then perform the looping within you script code.
I have written a macro that simplifies this process somewhat, and can be downloaded from
HERE. Save it to a file in your GIMP scripts folder and then code such as the following should work. (Warning: this command will overwrite the original JPEG files.)
%gimp% -i -f -b "(with-files \"*.jpg\"
(file-jpeg-save RUN-NONINTERACTIVE
image
layer
filename
filename
90 ; jpg compression
0 ; smoothing
1 ; optimize
1 ; progressive
\"\" ; comment
0 ; subsmp (0-4)
1 ; baseline
0 ; restart
0 ;dct
))"