In a Windows environment, I would like to call GIMP to execute a python-fu script (via a BAT file), but the command line call that I use does not give the expected results.
For example, consider the following python-fu script with a name makeafile_and_quit.pythat is in my GIMP folder plug-ins. Its purpose is to upload an existing image and save it under a different name:
from gimpfu import *
def makeafile_and_quit( ) :
FILEPATH = 'C:\\path\\to\\file.JPG'
IMAGE = pdb.gimp_file_load( FILEPATH, FILEPATH )
pdb.gimp_file_save( IMAGE, pdb.gimp_image_get_active_drawable( IMAGE ), FILEPATH + '_2.jpg', FILEPATH + '_2.jpg' )
pdb.gimp_quit(0)
return
register(
'makeafile_and_quit_script',
'v0.0',
'A new concept',
'Author',
'Author',
'Just now',
'<Toolbox>/MyScripts/This will make a file and _QUIT',
'',
[],
[],
makeafile_and_quit
)
main()
The script runs flawlessly if called from a "GUI instance" of GIMP, invoking the script through the menu. It creates a new file ending with "_2.jpg" in the same folder as the original file.
When called from the command line, the behavior is different from the following:
"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" --batch '("makeafile_and_quit.py")' -b "(gimp-quit 0)"
GIMP, , , batch command executed successfully.
, "GUI-", ?