> > Further I open the command line, go to the directory that contains my
> > pictures to be processed and type:
> > gimp-2.6 -i --batch-interpreter=python-fu-eval -b python-fu-my-function
> > which starts to print the usual loading commands but stops with:
> > Starting extension: 'extension-script-fu'
> > batch command experienced an execution error
> > Is there essentially anything wrong with my syntax?
> Please post a simple example script to illustrate what you are trying to
Of course I forgot the important part, so there you go.
My script/plugin is to be used predominantly from the command line in batch
What it does:
1) Make a list of jpg-files
2) load each jpg and apply a predefined path (provided by an SVG-file) onto it
3) off this path a selection is made and gets inverted
4) the inverted area is filled black
5) file gets saved
There is room for improvement but basically this is my script, some parts are
from gimpfu import *
path = 'G:\\to\\my\\directory'
#folder_list = os.listdir(path)
#day = datetime.datetime.today().strftime("%Y%m%d")
# for testing set specific date for variable 'day'
day = '20100826' # temporarily set a specific day for testing
datestring = path + '\\' + day
# List of files of the current day's directory
filelist = os.listdir(datestring)
# filelist should contain just jpg-files.
filelist = [ a for a in filelist if '.jpg' in a]
pic = range(len(filelist))
for pic in filelist:
im = pdb.gimp_file_load(datestring + '\\' + pic, pic)
'G:\\to\\my\\directory\\thepath.svg', 1, 0)
pdb.gimp_path_to_selection(im, 'Auswahl', 2, 0, 0, 0, 0)
drawable = pdb.gimp_image_get_active_drawable(im)
pdb.gimp_image_crop(im, 1067, 1055, 296, 105)
# to be set relative to the current image
pdb.file_jpeg_save(im, drawable, datestring + '\\' +
pic[:-4] + '_cut.jpg', pic[:-4] + '_cut.jpg', 1, 0, 0, 0, 'none', 0,
0, 0, 0)
# registration function
"<Image>/New Scripts/My special script",
> > I guess the issues are the input paramters of the function. A function
> > requires an image and a drawable as input, am I right?
> No, procedures don't require any input parameters at all. For procedures
> to be run from the image menu, it makes sense to have an image and a
> drawable parameters, but even there this is not a requirement.
Another question that keeps me busy: Are the GIMP modules available only within
the GIMP-Python console? So no other console (IDLE in my case) has access to
them? That would make things by far easier I guess.
Gimp-developer mailing list